Skip to content

Instantly share code, notes, and snippets.

@exodist
Created February 12, 2013 22:48
Show Gist options
  • Save exodist/4774202 to your computer and use it in GitHub Desktop.
Save exodist/4774202 to your computer and use it in GitHub Desktop.
eval example
package My::Thing;
use strict;
BEGIN {
$INC{'My/Thing.pm'} = __FILE__;
}
sub import {
my $caller = caller;
eval <<" EOT" || die $@;
package $caller;
print "Caller: \$caller\n";
use vars qw/\@foo \$bar/;
EOT
}
package consumer;
use strict;
use My::Thing;
$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