[ABE.pm] And another thing...
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Mon May 22 20:40:26 PDT 2006
* "Faber J. Fedor" <faber at linuxnj.com> [2006-05-22T22:09:55]
> On 22/05/06 14:00 -0400, Ricardo SIGNES wrote:
> > > Not at all. As I stated before, my problem was not calling the base
> > > class' construstor when I created the derived class.
> >
> > ...but with the code I provided, you don't need to do that.
>
> I understand that. What I was trying to do was to build on the $self
> object, i.e. my base class defines $self->{date}, $self->{template},
> etc. which all of the derived classes need. Then each derived class
> adds to $self the variables the derived class needs. This way I don't
> need to call '$dbh = get_dbh()' in every function that needs to do a SQL
> stmt (which are quite a few).
...but then don't you end up always having to say, for example:
my $dbh = $self->{dbh};
# or
my $sth = $self->{dbh}->prepare(...)
What I'm wondering is why it's not better to say:
my $sth = $self->dbh->prepare(...);
...where the dbh method is the get_dbh method with a few fewer chars. I feel
like one of us is missing something, and it very well may be me!
--
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/2d96772d/attachment.bin
More information about the ABE-pm
mailing list