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;
####
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.
####
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