This could also be a good time to check if your editor supports macros.
Perhaps that would be a solution that would be easier on your hands but
would enable you to keep your package names simple and easy to read/edit.

-----Original Message-----
From: James Edward Gray II [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 12:51 PM
To: David Garamond
Cc: Timothy Johnson; [EMAIL PROTECTED]
Subject: Re: package name alias (for shorter variable name)


I haven't tested it, but I'm quite sure:

my $p = 'Long::Package::Name';
$p->constant;

....works as expected.  If memory serves this is even allowed under the 
strict pragma.  If not though, you could always localize a block with 
no strict 'refs' where you need it.

James Gray

On Friday, October 4, 2002, at 02:31  PM, David Garamond wrote:

> Timothy Johnson wrote:
>> I'm not sure if this is a GOOD idea, but I THINK you can actually get 
>> away
>> with something like this:  In your module, insert a shorter package 
>> name,
>> but keep the module in the same place. So:
>>      package Foo::Bar::Constants;
>>      #do stuff here
>>      package MyConst;
>>      $ConstantA = "My Constant";
>>      #add more constants here
>> Then you can do a 'use Foo::Bar::Constants', and then call the 
>> constants via
>> $MyConst::ConstantA;
>
> but i still want my constants to reside in Foo::Bar::Constants 
> package. it's just that sometimes, when i'm referring to the constants 
> *a lot*, i wish they were referrable with short names. but i prefer 
> not using Exporter and @EXPORT_OK.
>
> -- 
> dave
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

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

Reply via email to