jafoba has asked for the wisdom of the Perl Monks concerning the following question:
I can't seem to reference a package indirectly if the package name starts with a numeric.
The script:The pm:use strict; no strict 'refs'; my $pkg = '006CONFC'; eval "require $pkg" or warn $@; my $ref = *{${ $pkg . '::'}{'post'}}{CODE}; $ref or exit(0); $ref->();
package 006CONFC; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(post); sub post { print "MADE IT\n"; } 1;
Using the debugger or -w, I get "Use of uninitialized value in ref-to-glob cast" on the my $ref line. I then change '006CONFC' in the script to something like 'x006CONFC' and create x006CONFC.pm. The script works fine. Does anyone know the reason or even better, the solution?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Package starting with numeric not recognized
by ikegami (Patriarch) on Sep 09, 2009 at 20:17 UTC | |
by jafoba (Novice) on Sep 09, 2009 at 20:28 UTC | |
|
Re: Package starting with numeric not recognized
by almut (Canon) on Sep 09, 2009 at 19:57 UTC |