Re: package name

2005-12-13 Thread John Doe
Brent Clark am Dienstag, 13. Dezember 2005 13.25: > Hi all Hi Brent > For some reason I keep geting this message. > > Global symbol "$arguments" requires explicit package name at sql_handler.pm > line 37. Global symbol "$arguments" requires explicit package name at > sql_handler.pm line 40. Globa

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
Jeff 'japhy' Pinyan wrote: > %Foo::Bar::Constants::. But anyway, here's the trick I'd use: > > *short:: = *Foo::Bar::Constants::; > print $short::name; # $Foo::Bar::Constants::name ah thanks, this package aliasing thingie is what i had been trying to accomplish several hours earlier, to

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
Jeff 'japhy' Pinyan wrote: > It's important to know that those "constants" aren't as efficient as their > non-method syntax cousins: > > package FOO; > use constant BAR => 10; > > package main; > print FOO::BAR; # at compile-time, Perl makes that 'print 10' > print FOO->BAR;

Re: package name alias (for shorter variable name)

2002-10-04 Thread Jeff 'japhy' Pinyan
On Oct 5, David Garamond said: >James Edward Gray II wrote: >> Building on this though, if you made the constants module, couldn't you >> make them subs? I believe this is even how the use constant pragma >> functions. Heck make it an object oriented module with static methods >> and it's even

Re: package name alias (for shorter variable name)

2002-10-04 Thread Jeff 'japhy' Pinyan
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 >

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
Bob Showalter wrote: >use Foo::Bar::Constants (); >{ package X; Foo::Bar::Constants->import } >print $X::alice->{name};# prints "Alice" > > Here your using the Exporter functionality, but exporting symbols into the > "X" namespace instead of your current namespace. The empty paren

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
James Edward Gray II wrote: > Building on this though, if you made the constants module, couldn't you > make them subs? I believe this is even how the use constant pragma > functions. Heck make it an object oriented module with static methods > and it's even designed well. Just a thought. g

RE: package name alias (for shorter variable name)

2002-10-04 Thread Bob Showalter
> -Original Message- > From: David Garamond [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 04, 2002 3:17 PM > To: Bob Showalter > Cc: [EMAIL PROTECTED] > Subject: Re: package name alias (for shorter variable name) > > > thanks for the answer, bo

Re: package name alias (for shorter variable name)

2002-10-04 Thread James Edward Gray II
You're right and I learn something new all the time. Building on this though, if you made the constants module, couldn't you make them subs? I believe this is even how the use constant pragma functions. Heck make it an object oriented module with static methods and it's even designed well.

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
James Edward Gray II wrote: > 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

RE: package name alias (for shorter variable name)

2002-10-04 Thread Timothy Johnson
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. I

Re: package name alias (for shorter variable name)

2002-10-04 Thread James Edward Gray II
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, Octobe

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
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 > >

Re: package name alias (for shorter variable name)

2002-10-04 Thread David Garamond
thanks for the answer, bob. Bob Showalter wrote: > There's nothing that says the file Foo/Bar/Constants.pm must have a "package > Foo::Bar::Constants" declaration. true, and i've realized that. i come from a python background and by contrast, in python, filename and directory name dictate the

RE: package name alias (for shorter variable name)

2002-10-04 Thread Bob Showalter
> -Original Message- > From: David Garamond [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 04, 2002 2:05 PM > To: [EMAIL PROTECTED] > Subject: package name alias (for shorter variable name) > > > i have several "constants" in a package: > >package Foo::Bar::Constants; >$alic

RE: package name alias (for shorter variable name)

2002-10-04 Thread Timothy Johnson
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; $Constant