in reply to Re: Side effects of use-ing base (vs our @ISA)
in thread Side effects of use-ing base (vs our @ISA)

Thanks, that makes sense to me now. perldoc base:

'use base qw[Foo Bar]' is roughly equivalent to: BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar); } ... If any of the base classes are not loaded yet, *base* silently "require"s them.

It seems like quite a subtle bug to fall into - you can use @ISA directly to declare a subclass of Exporter and think you're getting an import method from the superclass, but actually because you haven't loaded Exporter, silently nothing will happen when you use the subpackage...

cheers
ViceRaid

Replies are listed 'Best First'.
Re: Re: Re: Side effects of use-ing base (vs our @ISA)
by bobn (Chaplain) on Sep 10, 2003 at 13:19 UTC

    It seems like quite a subtle bug to fall into

    Yes it does. But what it says to me is: "Don't export. Use the OO scheme fully instead. Minimize use of globals and declare and use them in one file only."

    --Bob Niederman, http://bob-n.com

    All code given here is UNTESTED unless otherwise stated.