Uncomment this line:
my ($Registry, $IEKey);
and it will work. $Registry was not defined while using strictures.
Output (linux):
No module
None of that stuff here
Update:
Not tested on Windows, though (not available here). If that still fails, you have another problem.
Perhaps, you need to call the import() class method:
eval { require Win32::TieRegistry;
Win32::TieRegistry->import();
};
Update2: My try on a cleanup, after getting hands on a Windows system:
use strict;
use warnings;
our $Registry;
BEGIN {
$Win32::TieRegistry::__LOADED = eval {
require Win32::TieRegistry;
Win32::TieRegistry->import( Delimiter => '/' );
1;
};
}
sub use_mod { $Win32::TieRegistry::__LOADED; }
print "On $^O\t-> ";
if ( use_mod ) {
my $IEKey = $Registry->{'HKEY_CURRENT_USER/Software/Microsoft/Inter
+net Explorer/Main/'};
print 'Show status bar: ', $IEKey->{'/Show_StatusBar'}, "\n";
} else {
print "None of that stuff here.\n";
}
__DATA__
On MSWin32 -> Show status bar: yes
On linux -> None of that stuff here.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|