Summary | Package variables | Description | General documentation | Methods |
WebCvs | Raw content |
import | No description | Code |
import | description | prev | next | Top |
my ($callpack) = caller(0); # Name of the calling package}
my $pack = shift; # Need to move package off @_
# Get list of variables supplied, or else
# all of General:
my @vars = @_ ? @_ : keys( %Config ); return unless @vars; # Predeclare global variables in calling package
eval "package $callpack; use vars qw(" . join(' ', map { '$'.$_ } @vars) . ")"; die $@ if $@; foreach my $var (@vars) { if ( defined $Config{ $var } ) { no strict 'refs'; foreach my $key (keys %{$Config{$var}}) { # Exporter does a similar job to the following
# statement, but for function names, not
# scalar variables:
*{"${callpack}::$key"} =\$ Config{$var}{$key}; } } else { die "Error: Config: $var not known\n"; } } } 1;