package FS::table_name;
use strict;
-use vars qw (@ISA);
-use Exporter;
-#use FS::UID qw(getotaker);
-use FS::Record qw(hfields qsearch qsearchs);
+use vars qw( @ISA );
+use FS::Record qw( qsearch qsearchs );
@ISA = qw(FS::Record);
use FS::table_name;
- $record = create FS::table_name \%hash;
- $record = create FS::table_name { 'column' => 'value' };
+ $record = new FS::table_name \%hash;
+ $record = new FS::table_name { 'column' => 'value' };
$error = $record->insert;
=over 4
-=item create HASHREF
+=item new HASHREF
Creates a new example. To add the example to the database, see L<"insert">.
=cut
-sub create {
- my($proto,$hashref)=@_;
+# the new method can be inherited from FS::Record, if a table method is defined
- $proto->new('table_name',$hashref);
-
-}
+sub table { 'table_name'; }
=item insert
=cut
-sub insert {
- my($self)=@_;
-
- #local $SIG{HUP} = 'IGNORE';
- #local $SIG{INT} = 'IGNORE';
- #local $SIG{QUIT} = 'IGNORE';
- #local $SIG{TERM} = 'IGNORE';
- #local $SIG{TSTP} = 'IGNORE';
-
- $self->check or
- $self->add;
-}
+# the insert method can be inherited from FS::Record
=item delete
=cut
-sub delete {
- my($self)=@_;
-
- $self->del;
-}
+# the delete method can be inherited from FS::Record
=item replace OLD_RECORD
=cut
-sub replace {
- my($new,$old)=@_;
- return "(Old) Not a table_name record!" unless $old->table eq "table_name";
-
- return "Can't change keyfield!"
- unless $old->getfield('keyfield') eq $new->getfield('keyfield');
-
- $new->check or
- $new->rep($old);
-}
-
+# the replace method can be inherited from FS::Record
=item check
Checks all fields to make sure this is a valid example. If there is
an error, returns the error, otherwise returns false. Called by the insert
-and repalce methods.
+and replace methods.
=cut
-sub check {
- my($self)=@_;
- return "Not a table_name record!" unless $self->table eq "table_name";
+# the check method should currently be supplied - FS::Record contains some
+# data checking routines
+sub check {
+ my $self = shift;
''; #no error
}
=head1 VERSION
-$Id: table_template.pm,v 1.3 1998-11-15 04:33:00 ivan Exp $
+$Id: table_template.pm,v 1.4 1998-12-29 11:59:57 ivan Exp $
=head1 BUGS
=head1 SEE ALSO
-L<FS::Record>
+L<FS::Record>, schema.html from the base documentation.
=head1 HISTORY
ivan@sisd.com 97-nov-13
$Log: table_template.pm,v $
-Revision 1.3 1998-11-15 04:33:00 ivan
+Revision 1.4 1998-12-29 11:59:57 ivan
+mostly properly OO, some work still to be done with svc_ stuff
+
+Revision 1.3 1998/11/15 04:33:00 ivan
updates for newest versoin
Revision 1.2 1998/11/15 03:48:49 ivan