From aa3f08493d04303e253459eeb8182d8352984ace Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 10 Jul 2013 17:21:17 -0400 Subject: allow getting functions to export from other places --- lib/Exporter/Lexical.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Exporter/Lexical.pm b/lib/Exporter/Lexical.pm index 48e4d72..5714dca 100644 --- a/lib/Exporter/Lexical.pm +++ b/lib/Exporter/Lexical.pm @@ -77,8 +77,14 @@ sub build_exporter { no strict 'refs'; \%{ $caller . '::' }; }; - my @exports = @{ $opts->{'-exports'} }; - my %exports = map { $_ => \&{ $caller_stash->{$_} } } @exports; + my %exports; + if (ref($opts->{'-exports'}) eq 'ARRAY') { + %exports = map { $_ => \&{ $caller_stash->{$_} } } + @{ $opts->{'-exports'} }; + } + elsif (ref($opts->{'-exports'}) eq 'HASH') { + %exports = %{ $opts->{'-exports'} }; + } for my $export (keys %exports) { lexical_import($export, $exports{$export}); -- cgit v1.2.3-54-g00ecf