in reply to Re^3: use and require inside subs
in thread use and require inside subs
I think you meanBEGIN { 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
since the way you have it, perl will attempt to use that module even not on Win32.require Win32::TieRegistry; Win32::TieRegistry::->import(Delimiter=>"/", ArrayValues=>0 );
Another way:
if you have if.use if $^O eq 'MSWin32', "Win32::TieRegistry", Delimiter=>"/", ArrayValues=>0;
|
---|
In Section
Seekers of Perl Wisdom