Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Creating "Lexical" Symbol Table Aliases (a la "use vars") From The Same Package

by OneTrueDabe (Acolyte)
on May 08, 2014 at 16:50 UTC ( #1085478=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
       use strict 'vars';
    
    ...
       Variable "@foo" is not imported at foo.pl line 10.
       Global symbol "@foo" requires explicit package name at foo.pl line 
    +10.
       foo.pl had compilation errors.
    
  2. or download this
       use strict 'vars';
    
    ...
    
       package main;
          print "Foo: (@foo)\n";
    
  3. or download this
       use strict 'vars';
    
    ...
    
       package pkg;
          print "Foo: (@foo)\n";
    
  4. or download this
       use strict 'vars';
    
       package pkg;
          BEGIN { *pkg::foo = \@pkg::foo }
          print "Foo: (@foo)\n";
    
  5. or download this
        package pkg;
        sub BEGIN {
            *foo = \@foo;
        }
    
  6. or download this
       use strict 'vars';
    
    ...
       __OUTPUT__
    
       Foo: ()
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1085478]
Front-paged by Corion
help
Chatterbox?
[erix]: in this context, one learns all kinds of interesting psychological excuse-jargon: not just 'alternative facts'; how about 'gapped knowledge' ? :)
[erix]: which still manages to sound more or less positive
[Corion]: Huh. I wasn't aware that you cannot segregate Python 2 and Python 3 modules... Hopefully Perl 6 module use C6AN and thus avoid the problem...
[hippo]: I very much hope so.
[moritz]: there are already some (very few) Perl 6 modules on CPAN, but in a way that the p5 indexer avoids them
[hippo]: It's confusing enough to have the Perl6:: namespace which isn't for Perl6 but for features from that ported into Perl.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2017-01-24 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.