develooper Front page | perl.perl5.porters | Postings from May 2007

Re: use parent 'Some::Class' @import_list;

Thread Previous | Thread Next
From:
Ovid
Date:
May 2, 2007 05:48
Subject:
Re: use parent 'Some::Class' @import_list;
Message ID:
192597.21687.qm@web60814.mail.yahoo.com
--- Brandon Black <blblack@gmail.com> wrote:

> Personally, I think most people are better off without "use base".
> For MI, it's just:
> 
> use Foo;
> require Bar;
> our @ISA = qw/Foo Bar/;
> 
> You can choose require vs use to decide whether you want import
> called
> or not, and since it is assignment rather than pushes, it's not an
> efficiency issue like the individual push statements of base.pm.

It's worth noting that "our @ISA" generally means that base classes are
determined later than with "use base", thus ensuring that there's a
subtle, but distinct, difference.  Some trying to call inherited
methods before the @ISA gets assigned is going to be bitten by the
above code.
 
Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About