Hi *,
I am rather a beginner to Perl (and programming) but
am nevertheless faced with maintaining a complex OO
environment. Yikes! Anyway, here is my problem: I have
two classes whose constructors return a db handle. "A"
accepts parameters for user/password, while "B",
although it uses A to connect as well, does not
acccept any parameters, thus connecting only as root.
All the keen methods belong to the latter class, and
since I want to connect via CGI and display the
information they provide to the masses via their
browser, without them entering passwords, I need to
know how to use A's ability to connect with B's great
methods. I've heard of something called overloading,
but can this apply to constructors? Or do I need a
whole new class, copying and pasting the stuff I need,
cmopletely undermining the OO philosophy? I know
better than to mess with the "black box". Here are the
classes:
A
sub new {
my $proto=shift;
my $specs=shift;
my $class=ref($proto) || $proto;
my $self={};
$self->{connection}= X::connect($specs);
return undef unless defined $self->{$connection};
bless ($self,$class);
return $self;
B
sub new {
my $proto=shift;
my $specs=shift;
my $class=ref($proto) || $proto;
my $self={};
$self->{X} = X->new();
$self->{connection}= $self->{X}->{connection};
return undef unless defined $self->{$connection};
bless ($self,$class);
return $self;
Many many thanks for this wonderful mailing list.
Cheers, Blair
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]