Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Re: use Very::Long::Module::Name as Foo;

by liz (Monsignor)
on Oct 15, 2003 at 08:58 UTC ( #299357=note: print w/replies, xml ) Need Help??

in reply to Re: use Very::Long::Module::Name as Foo;
in thread use Very::Long::Module::Name as Foo;

As I try not to use indirect object syntax (anymore), I think the approach to define a constant is the most portable way for now. So no argument from me there (anymore).

It is in gross violation of the "do the simplest thing that can possibly work" principle.

I don't agree there. I still think my approach is the cleanest from the user's point of view. It doesn't need the definition of any extra variables or constants, which I think are cruft from an API point of view. And therefore, it is the simplest thing that can possibly work in my eyes.

Under the hood, Perl is already using rather heavy weaponry to DWIM. Constants are one (first create a subroutine, then inline the constant later). Tieing variables is another one. And what about $&? All can be done in other ways, yet everyone likes the fact that they're there if they want to take the performance penalty.

Personally, I think it would not be a real big issue to implement the "as modulename" feature in the C-code that handles "use" in Perl (which would put the namespace aliasing stuff under the hood there). And I think the effect on compiling would be negligeble (only extra complexity while compiling a "use"). However, the reason I'm not going to pursue this, is the global namespace problem. I don't see a simple solution for making the short name local to the package in which it "defined".


  • Comment on Re: Re: use Very::Long::Module::Name as Foo;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://299357]
[robby_dobby]: Corion: Yes, I know it's fun. We met at LPW last year. First time volunteer and all, it was fun! :-)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2018-04-19 12:42 GMT
Find Nodes?
    Voting Booth?