in reply to Re^19: can't import using exporter
in thread can't import using exporter
I disagree with your hints. But, more importantly, they miss an important point:
#!/usr/bin/perl -w use strict; { package DEBUG; our $var = 'foo'; } { package main; BEGIN { package Other; *main::var = \$DEBUG::var }; # ^^^^^^^^^^^^^ ^^^^^^ print "Var is $var\n"; } __END__ Var is foo
It doesn't actually have to be a third package, just not the destination package. So you could also use, for example:
BEGIN { package DEBUG; no strict 'vars'; *main::var = \$var };
- tye
|
|---|