Tk::Error: Can't call method "new_from_DBH" on an undefined value
1 2 3 4 5 6 7 8 9 10 11 12 13 14
sub new_from_DBH{ #if you have already DBI connection, you can use this my ($pkg, $dbh, $param) = @_; my $self = {}; $self->{'DBH_OBJ'} = $dbh; $self->{'param'} = {}; foreach my $key(keys %{$param}){ $self->{'param'}->{$key} = $param->{$key}; } bless($self, $pkg); return $self; }
my $mb = new_from_DBH DBD::Backup($dbh,{'USE_REPLACE' => 1, 'SHOW_TABLE_NAMES' => 1});
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package Foo; sub bar { print join( ", ", @_ ) . "\n"; } package Bar; our @ISA = 'Foo'; package main; Foo->bar(); Bar->bar();