package Demo1;
use base qw/Exporter/;
$SUCCESS = 1;
BEGIN {
use Exporter();
@ISA = qw(Exporter);
@EXPORT = qw( $SUCCESS )
}
1;
####
package Demo2;
sub import {
${[caller]->[0].'::'}{$_} = ${__PACKAGE__."::"}{$_}
foreach grep { not /^(ISA|isa|BEGIN|import|Dumper)$/ }
keys %{__PACKAGE__."::"};
}
use constant {
SUCCESS => 0,
};
1;
####
#!/usr/bin/perl
use strict;
use warnings;
use Demo1;
use Demo2;
print "SUCCESS: ", SUCCESS, "\n";
print "\$SUCCESS: $SUCCESS\n";
exit;
####
Bareword "SUCCESS" not allowed while "strict subs" in use at ./demo.pl line 9.
Execution of ./demo.pl aborted due to compilation errors.
####
#!/usr/bin/perl
use strict;
use warnings;
use Demo2;
use Demo1;
print "SUCCESS: ", SUCCESS, "\n";
print "\$SUCCESS: $SUCCESS\n";
exit;
####
SUCCESS: 0
$SUCCESS: 1