Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: passing a $var thru a "use module($var)"

by chip (Curate)
on Mar 16, 2004 at 15:11 UTC ( [id://337023]=note: print w/replies, xml ) Need Help??


in reply to passing a $var thru a "use module($var)"

Yes, the implicit BEGIN{} around use is killing you. But it's easy enough to kill it first:

my $pid; BEGIN { $pid = $$ } use Module $pid; # ta da

As a separate matter, you should beware about a numeric first argument to use because Perl may interpret it as a minimum required version for the given module.

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
Re: Re: passing a $var thru a "use module($var)"
by Anonymous Monk on Mar 17, 2004 at 04:53 UTC
    As a separate matter, you should beware about a numeric first argument to use because Perl may interpret it as a minimum required version for the given module.
    Not exactly because use isn't exactly a function (use(CGI=>3);).
    $$ perl use CGI 3; # what you're talking about use CGI ( 66 ); # a numeric literal, 1st argument, statement succeeds use CGI 66; # dies as should CGI version 66 required--this is only version 3.04 at - line 3. BEGIN failed--compilation aborted at - line 3.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-03-19 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found