perl-exporter

how to access variables in imported module in local scope in perl?

南笙酒味 提交于 2021-01-04 03:10:11
问题 I am stuck while creating a perl Moose module. I have a global pm module. package XYZ; require Exporter; our @ISA = qw(Exporter); ## EDIT missed this line our @EXPORT_OK = qw($VAR); my $VAR1 = 1; our $VAR = {'XYZ' => $VAR1}; 1; I want to get $VAR in a Moose module I'm creating package THIS; use Moose; use YAML::XS; sub get_all_blocks{ my ($self) = @_; require $self->get_pkg(); # this returns the full path+name of the above package # i cannot use use lib+use since the get_pkg starts

how to access variables in imported module in local scope in perl?

隐身守侯 提交于 2021-01-04 03:05:42
问题 I am stuck while creating a perl Moose module. I have a global pm module. package XYZ; require Exporter; our @ISA = qw(Exporter); ## EDIT missed this line our @EXPORT_OK = qw($VAR); my $VAR1 = 1; our $VAR = {'XYZ' => $VAR1}; 1; I want to get $VAR in a Moose module I'm creating package THIS; use Moose; use YAML::XS; sub get_all_blocks{ my ($self) = @_; require $self->get_pkg(); # this returns the full path+name of the above package # i cannot use use lib+use since the get_pkg starts