Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: use and require inside subs

by ysth (Canon)
on Nov 03, 2004 at 07:01 UTC ( [id://404829]=note: print w/replies, xml ) Need Help??


in reply to Re^3: use and require inside subs
in thread use and require inside subs

BEGIN { if ($^O eq 'MSWin32') { use Win32::TieRegistry( Delimiter=>"/", ArrayValues=>0 ); # load $config from registry } else { # else load $config from flat files } } # end system specific compile time code
I think you mean
require Win32::TieRegistry; Win32::TieRegistry::->import(Delimiter=>"/", ArrayValues=>0 );
since the way you have it, perl will attempt to use that module even not on Win32.

Another way:

use if $^O eq 'MSWin32', "Win32::TieRegistry", Delimiter=>"/", ArrayValues=>0;
if you have if.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2025-05-23 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.