Can't export symbol: 1varnameA
where $varnameA is a key in the @EXPORT array. An example array is:
I'm using 5.6.0 or 5.6.1 depending on the machine, and the complaint comes from Exporter::Heavy line 174:@EXPORT = qw($varnameA %varnameB &varnameC);
This became so irritating on one machine that a fellow coder of mine rewrote the code to not use $1 because that magic variable would, in fact, mysteriously have a value of 1. We would even print $sym so we could see what names it was iterating through - and it was correct. The $sym string would be "$varnameA". The order of the @EXPORT array did not matter. Naturally, if you didn't prefix an identifier with a type (a sub) then it would work fine.foreach $sym (@imports) { # shortcut for the common case of no type character (*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next) unless $sym =~ s/^(\W)//; $type = $1; *{"${callpkg}::$sym"} = $type eq '&' ? \&{"${pkg}::$sym"} : $type eq '$' ? \${"${pkg}::$sym"} : $type eq '@' ? \@{"${pkg}::$sym"} : $type eq '%' ? \%{"${pkg}::$sym"} : $type eq '*' ? *{"${pkg}::$sym"} : do { require Carp; Carp::croak("Can't export symbol: $type +$sym") }; }
I should make it clear that although we patched our Exporter::Heavy on one machine, that did not solve all of our problems..there were still a few creeping 1s, but at least we could get our code to run. I've been searching through our code trying to find what is breaking it, but there is a lot of code there...
Any ideas? Anyone ever seen this behavior before?
In reply to Exporter failing - the case of the creeping 1s by jargon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |