OK, here you go. A few adjustments: ConfigThisJunk.pm is actually ExportScalar.pm and the script name is ImportTest.pl. The package is in the folder 'D:/Marcos/Perl/MSB/SS' in my Windows machine. Hence, your line got modified to:
perl -wle"use lib 'D:/Marcos/Perl/MSB'; use SS::ExportScalar; print $INC{'SS/ExportScalar.pm'};"
and that resulted in
D:/Marcos/Perl/MSB/SS/ExportScalar.pm
And then the results of the type statements:
type ExportScalar.pm
use strict;
use warnings;
use Exporter;
our @ISA = qw( Exporter );
our @EXPORT_OK = qw( DEBUG );
our $DEBUG = 1;
sub DEBUG {
if (@_) { $DEBUG = shift; }
return $DEBUG;
}
1;
type ImportTest.pl
#!/usr/bin/perl -w
use strict;
use warnings;
use lib 'D:/Marcos/Perl/MSB';
use SS::ExportScalar qw( DEBUG );
my $x = 123;
print("debug: x is $x\n") if DEBUG;
Now I execute it:
perl ImportTest.pl
Bareword "DEBUG" not allowed while "strict subs" in use at ImportTest.
+pl line 7.
Execution of ImportTest.pl aborted due to compilation errors.
Now, I change the strict statement in ImportTest.pl:
type ImportTest.pl
#!/usr/bin/perl -w
use strict qw (vars refs);
use warnings;
use lib 'D:/Marcos/Perl/MSB';
use SS::ExportScalar qw( DEBUG );
my $x = 123;
print("debug: x is $x\n") if DEBUG;
perl ImportTest.pl
Bareword found in conditional at ImportTest.pl line 7.
debug: x is 123
X:^P
-
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.