Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

%Export warning?

by xiaoyafeng (Chaplain)
on Aug 12, 2011 at 07:49 UTC ( #919992=perlquestion: print w/replies, xml ) Need Help??
xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

The built-in Exporter module is hard to use. I prefer Perl6::Export to do this job.

But the problem which is annoying me is it conflict with use strict, script would complain

package Win32::ExcelSimple; use Perl6::Export; use strict; use warnings; ....... ...... sub qux is export(:MANDATORY) { print "quuuuuuuuux!"; } __OUTPUT__ C:\strawberry\perl\site\lib\Win32>perl -c C:\strawberry\perl\site\lib\ +Win32\Exce Variable "%EXPORT" is not imported at C:\strawberry\perl\site\lib\Win3 +2\ExcelSim line 78. Variable "%EXPORT_TAGS" is not imported at C:\strawberry\perl\site\lib +\Win32\Exc line 78. Global symbol "@EXPORT_OK" requires explicit package name at C:\strawb +erry\perl\ site\lib\Win32\ line 78. Global symbol "%EXPORT" requires explicit package name at C:\strawberr +y\perl\sit e\lib\Win32\ line 78. Global symbol "%EXPORT_TAGS" requires explicit package name at C:\stra +wberry\per l\site\lib\Win32\ line 78. BEGIN not safe after errors--compilation aborted at C:\strawberry\perl +\site\lib\ Win32\ line 78.
Any helps?

UPDATE: s/hardly/hard/ Thanks to Anonymous monk ;)

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: %Export warning?
by Anonymous Monk on Aug 12, 2011 at 09:25 UTC
Re: %Export warning?
by Khen1950fx (Canon) on Aug 12, 2011 at 10:26 UTC
    This probably isn't any help, but I ran it through B::Deparse and went with this:
    package Win32::ExcelSimple; sub BEGIN { require Perl6::Export; do { 'Perl6::Export'->import(':DEFAULT'); }; } sub _import_2763e65d482f2fbdacbc4240619d518b { } use base ('Exporter'); sub import { my @exports; for ( my $i = 1 ; $i < @_ ; ++$i ) { foreach $_ ( $_[$i] ) { if ( not ref $_ and /^[:\$&%\@]?(\w+)$/ and exists $EXPORT{$1} || exists $EXPORT_TAGS{$1} ) { push @exports, splice( @_, $i, 1 ); --$i; } } } @exports = ':DEFAULT' unless @exports; 'foo'->export_to_level( 1, $_[0], ':MANDATORY', @exports ); goto \&_import_2763e65d482f2fbdacbc4240619d518b; } sub BEGIN { $EXPORT_TAGS{'MANDATORY'} ||= []; } sub BEGIN { push @EXPORT_OK, 'bar'; $EXPORT{'bar'} = 1; push @{ $EXPORT_TAGS{$_}; }, 'bar' foreach ( 'ALL', () ); } sub bar (:DEFAULT) { print 'phooey!'; } print &bar, "\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://919992]
Front-paged by Arunbear
and a soft breeze sighs...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-04-25 18:45 GMT
Find Nodes?
    Voting Booth?