I need the subroutine to make changes to that hash, when called. (I'm aware this is an unusual interface and I do have good reasons for wanting to do it.) I can't seem to get this part right.
I'm using something like:
#!/usr/bin/perl
package MyExporter;
use strict; use warnings;
use Exporter; our @ISA = 'Exporter'; our @EXPORT = qw/ %hash routine /;
our %hash = (Test => 'Works!');
sub routine { my($caller) = caller; $$caller::hash{Another_Test} = 'Doesn\'t work!'; }
1;
__END__
When I use Data::Dumper from the module using the example above, I get:
$VAR1 = { 'Test' => 'Works!' };
I'm confused about why the above doesn't work. Exporter isn't somehow creating a lexical variable out of that hash, is it? I guess this is my first question: What am I not understanding about the above?
Second question: What is the correct way to do what I'm trying to do?
Thanks for your time and any tips you can pass on.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>