Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Module Naming Dilemma

by jdporter (Paladin)
on Jan 04, 2005 at 22:05 UTC ( [id://419423]=note: print w/replies, xml ) Need Help??


in reply to Module Naming Dilemma

Hmmmm... I did something along the same lines, a long time ago. Lemme see if I can find it...

Ah, here it is - Exporter::PkgAlias.

Unfortunately, it seems I never uploaded it to CPAN. I should remedy that...

Replies are listed 'Best First'.
Re^2: Module Naming Dilemma
by Ovid (Cardinal) on Jan 04, 2005 at 22:10 UTC

    Your module really is aliasing a namespace, yes? Mine just creates a subroutine that returns the package name and inserts it into the calling namespace (after doing some stuff to handle loading and importing.)

    The important thing here is that the module name be very short to actually make it worthwhile to use. It's also been pointed out that this makes it easier to use a module that's merely been renamed.

    Cheers,
    Ovid

    New address of my CGI Course.

      Well, in answer to your question... I assume you're aware of the general restrictions/caveats on both top-level namespaces and lower-case namespaces. You should discuss your naming idea on comp.lang.perl.modules, and then on modules@perl.org which is where the PAUSE police lurk. I don't know who has the authority to issue a pragmatic module name; probably p5p or the pumpking.

      Wouldn't it be simpler for
      use class 'My::Company::Namespace::Customer';
      to do the import and just:
      @Customer::ISA = 'My::Company::Namespace::Customer';

      On second thought, I think I prefer your way. Less side-effects that I can see.

      I hope that you've documented (and possibly checked!) that your aliases can't contain things like :: in them.

      If I didn't know how it was implemented, I could easily see myself being bitten by that.

      (Note: I happen to agree with Perrin's response in your diary. I happen to dislike the idea and wouldn't use it. But then again, I don't have to.)

        I don't understand. Why can't they have "::" in them? This works:

        use aka "Really::Long::Module::Name", as => "R::Name"; my $foo = R::Name->some_class_method;

        However, messing with someone else's namespace is a really bad idea and it is documented that the programmer shouldn't do that.

        Cheers,
        Ovid

        New address of my CGI Course.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://419423]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2024-03-28 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found