skip comment & blank lines
[freeside.git] / eg / table_template.pm
1 package FS::table_name;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record qw( qsearch qsearchs );
6
7 @ISA = qw(FS::Record);
8
9 =head1 NAME
10
11 FS::table_name - Object methods for table_name records
12
13 =head1 SYNOPSIS
14
15   use FS::table_name;
16
17   $record = new FS::table_name \%hash;
18   $record = new FS::table_name { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::table_name object represents an example.  FS::table_name inherits from
31 FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item field - description
36
37 =back
38
39 =head1 METHODS
40
41 =over 4
42
43 =item new HASHREF
44
45 Creates a new example.  To add the example to the database, see L<"insert">.
46
47 Note that this stores the hash reference, not a distinct copy of the hash it
48 points to.  You can ask the object for a copy with the I<hash> method.
49
50 =cut
51
52 # the new method can be inherited from FS::Record, if a table method is defined
53
54 sub table { 'table_name'; }
55
56 =item insert
57
58 Adds this record to the database.  If there is an error, returns the error,
59 otherwise returns false.
60
61 =cut
62
63 # the insert method can be inherited from FS::Record
64
65 =item delete
66
67 Delete this record from the database.
68
69 =cut
70
71 # the delete method can be inherited from FS::Record
72
73 =item replace OLD_RECORD
74
75 Replaces the OLD_RECORD with this one in the database.  If there is an error,
76 returns the error, otherwise returns false.
77
78 =cut
79
80 # the replace method can be inherited from FS::Record
81
82 =item check
83
84 Checks all fields to make sure this is a valid example.  If there is
85 an error, returns the error, otherwise returns false.  Called by the insert
86 and replace methods.
87
88 =cut
89
90 # the check method should currently be supplied - FS::Record contains some
91 # data checking routines
92
93 sub check {
94   my $self = shift;
95
96   ''; #no error
97 }
98
99 =back
100
101 =head1 BUGS
102
103 The author forgot to customize this manpage.
104
105 =head1 SEE ALSO
106
107 L<FS::Record>, schema.html from the base documentation.
108
109 =cut
110
111 1;
112