in reply to Re^3: How can I avoid creating two instances of the same object
in thread How can I avoid creating two instances of the same object
Here is the load_package method of the CBIDatabase classuse Data::Dumper; use CBIDatabase; my $dbh = CBIDatabase->new(); $dbh->load_package('Company'); my %company; $company{'id'} = '03459875437'; my $ref = $dbh->Company::client(\%company,'*',); print "\n\nAsking for all matching table info:\n"; print Dumper($ref);
I'm excited! This seems to work very well. I don't like to use eval statements but I think I'll have to if I want to require the modules dynamically. Again thanks for all of the help. This is a very old database that didn't follow any of the rules, that class::dbi seemed to need.use strict; use DBI; my @ISA = qw(Company); sub load_package { my $self = shift; my $package = shift; require eval{$package.'.pm'}; } sub new { ## database stuff here }
|
|---|