[Chicago-talk] Why do I need "use"

Steven Lembark lembark at wrkhors.com
Wed Mar 1 14:47:35 PST 2006



-- brian d foy <brian.d.foy at gmail.com>

> On 2/27/06, Jay Strauss <me at heyjay.com> wrote:
> 
>> My question is: Why do you have to use "use"?  Perl is so forgiving in
>> many cases, and you can load modules at runtime.  Why doesn't Perl just
>> automatically load modules it discovers in the source?
> 
> There is Class:Autouse if you want that sort of behavior.  Otherwise,
> Larry's answer to these sorts of things has been "Because." :)

You can also delay the use with:

    Object::Trampoline::Use->connect( 'DBI', ... ) 

which delays everything until one of the DBI object's
methods is really called. Problem there is that if DBI
is going to fail for any reason you won't find it out
until fairly late in the code (vs. at the start with
use).

-- 
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list