Last active
December 12, 2015 12:48
-
-
Save exodist/4774332 to your computer and use it in GitHub Desktop.
no eval
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package My::Thing; | |
use strict; | |
BEGIN { | |
$INC{'My/Thing.pm'} = __FILE__; | |
} | |
sub import { | |
my $class = shift; | |
my $caller = caller; | |
my $string = "Foo"; | |
my $sym = "$caller\::bar"; | |
no strict 'refs'; | |
*$sym = \$string; | |
} | |
package consumer; | |
use strict; | |
use My::Thing; | |
print("Bar: $bar\n"); | |
$bar = "This is sparta!"; | |
print("Bar: $bar\n"); | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment