Thank you all for your advice and for your help. I figured out how to get this done! Here is my final working code. I am loading my @ISA in the beginning with each of my packages and I am requiring the package in a method using an eval statement. It looks a little wierd but it works. I'll get a better benchmark of the speed when I get a good prototype working. Here is my calling script and the relevant methods.
use 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);
Here is the load_package method of the CBIDatabase class
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
}
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.