Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: 'use' falls out of scope at runtime

by perrin (Chancellor)
on Apr 23, 2009 at 14:02 UTC ( [id://759532]=note: print w/replies, xml ) Need Help??


in reply to 'use' falls out of scope at runtime

Are you saying that the second time you run that use, it doesn't reload an already loaded module? That's just how Perl works, but you can use workarounds like Apache2::Reload.
  • Comment on Re: 'use' falls out of scope at runtime

Replies are listed 'Best First'.
Re^2: 'use' falls out of scope at runtime
by arpx (Acolyte) on Apr 23, 2009 at 14:29 UTC
    no, it falls out... the module is not available.

    Thu Apr 23 14:20:57 2009 error client xxxx Undefined subroutine &plugin23::test called at ..

    the only way to keep it in enviroment is to trigger the function calling 'use' for each run

      use called a second time doesn't reload the module, since it checks %INC (see perlvar) and, if the module is already in that hash, the underlying require just returns 1, so no loading. You would have to undef $INC{$module} for the use to reload the module. Keep in mind that in %INC the key for Some::Module is Some/Module.pm.

      Aa Corion said, you could use Apache::Reload for those packages; if you have changing packages where methods/functions are organized into files, you could use AutoReloader.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://759532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-24 17:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found