package file testpackage.pm:
package testpackage;
use warnings;
use strict;
use Data::Dumper;
use Exporter 'import';
our @EXPORT = qw ( somesub );
sub somesub{
my ($name)=@_;
my @caller=caller(0);
my $package=$caller[0];
my $evalstr = '$'.$package.'::'.$name.' = 42;';
eval($evalstr);
}
1;
script file testscript.pl:
#!/usr/bin/env perl
use warnings;
use strict;
use testpackage;
somesub('tricky');
print "hello, tricky is '$main::tricky'\n";
When I run this script, I get the warning:
Name "main::tricky" used only once: possible typo at ./testscript.pl
is there a way to suppress this error from inside testpackage.pm somehow?
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm