Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: DWIM: autoloading classes

by tsee (Curate)
on Sep 17, 2003 at 19:26 UTC ( [id://292280]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: DWIM: autoloading classes
in thread DWIM: autoloading classes

While I'm too tired to implement it, one should be able to add import functionality to the above code so that symbols exported by Foo::Bar via "use Foo 'Bar';" are exported to the calling namespace. That should be doable by testing whether Foo::Bar uses Exporter to handle import() and friends and use the export_to_level() routine from Exporter. If the module uses its own import routine, one might... well... do evil things with eval and package.

Replies are listed 'Best First'.
Re: Re: Re: DWIM: autoloading classes
by liz (Monsignor) on Sep 18, 2003 at 03:00 UTC
    Not that I want to export anything: I do everything OO and nothing gets exported in my modules. If there are any global flags that would need to be set, I use class method accessors for them.

    But anyway, but I fail to see what more evil things you could do with an exporter that you couldn't already do.

    So what ev(i|a)l things exactly are you referring to?

    Liz

      Stuff like string eval of changing to the calling package and invoking the import routine from there. Then go back to the (main module) package you were using to load the other modules.
      I don't know whether that's already enough to fool caller().

      Steffen

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://292280]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.