"Rodrigo Roman" <[EMAIL PROTECTED]> wrote:
> Can anybody help me (or tell where to find help) to
> inherit the DBI class.
Here is a snip from a module I wrote that subclasses / inherits from DBI
(not that it references an example file that comes in the distribution):
#=====================================================================
package LUDBI;
@ISA = qw(DBI);
use DBI;
use strict;
sub lu_connect {
# Note that other classes may inherit and use this method only
# if they also subclass LUDBI::db and LUDBI::st in the same
# manner that LUDBI subclasses DBI::db and DBI::st. See
# ./t/subclass.t in the DBI install directory for the basic
# example of subclassing the DBI from which this module was
# modelled.
# ...
}
# etc...
#=====================================================================
package LUDBI::db;
use vars qw( @ISA );
@ISA = qw( DBI::db);
sub lu_quote {
my $self = shift;
my $string = shift
or die "$self->lu_quote was not passed a string as required!";
my $delimiter = ( @_ ) ? shift : '';
if ($delimiter) {
my @strings = split $delimiter, $string;
foreach (@strings) { $_ = $self->quote($_) }
$string = join $delimiter, @strings;
} else {
$string = $self->quote($string);
}
return $string;
}
#=====================================================================
package LUDBI::st;
use vars qw( @ISA );
@ISA = qw(DBI::st);
1;
--
Phil R Lawrence