On Oct 5, David Garamond said:

>indeed. i still want to name my package Foo::Bar::Constants. the 'X' (or
>let's name it 'tmp') is just a temporary prefix to help ease my weary
>typing hands. in python i can do something like this:
>
>  import Foo.Bar.Constants
>  print Foo.Bar.Constants.alice
>  tmp = Foo.Bar.Constants
>  print tmp.alice
>  tmp2 = tmp
>  print tmp2.alice
>
>the three 'print' statements print the same thing. i had thought that in
>perl we can do some aliasing with the symbol table (the * and \*
>stuffs)? this is one beast i have yet to understand.
>
>> Another approach might be to stuff those values into a hash and export just
>> the hash:
>
>hm, i don't think i like this approach. i don't want to hashify everything.

You already HAVE an implicit hash (just like in Python).  It's
%Foo::Bar::Constants::.  But anyway, here's the trick I'd use:

  *short:: = *Foo::Bar::Constants::;
  print $short::name;  # $Foo::Bar::Constants::name

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to