Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

(tye)Re: Passing parameters to a module's import function

by tye (Sage)
on Feb 12, 2001 at 08:46 UTC ( [id://57838]=note: print w/replies, xml ) Need Help??


in reply to Re (tilly) 1: Passing parameters to a module's import function
in thread Passing parameters to a module's import function

Um, tilly, in the sample usage:

use MyModule { foo => 1, bar => 'two' };

are you suggesting that having Exporter.pm know about not just "foo" and "bar" but also "1" and "two" and all other possible parameter values and then having it either export them or report them as failing one at a time is somehow useful? (And your third option seems to have little to do with what was being asked.) (:

No, Exporter.pm does not provide any way of dealing with such options. You can look at Win32::TieRegistry for an example of how to parse such options while still supporting standard exporting (and non-standard exporting). But you'll probably want to ignore most of the code in Win32::TieRegistry::import as I doubt you'll want to support the strange exporting that is supported there. You might have more luck looking at Win32::TieRegistry::SetOptions.

Update: I hate this font. () and {} are nearly identical. The stuff I was talking about deals with this:

use MyModule ( foo => 1, bar => 'two' );

kind of stuff. ):

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re (tilly) 2: Passing parameters to a module's import function
by tilly (Archbishop) on Feb 12, 2001 at 08:55 UTC
    I gave 3 methods.

    One of which I specifically said is only useful for flags.

    The other two, including my actual code sample (which was very specifically designed to handle an anonymous hash as a case) work just fine.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found