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

Re: Re: DWIM: autoloading classes

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


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 07: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-23 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found