Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Module Naming Dilemma

by Ovid (Cardinal)
on Jan 04, 2005 at 22:10 UTC ( [id://419426]=note: print w/replies, xml ) Need Help??


in reply to Re: Module Naming Dilemma
in thread Module Naming Dilemma

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.

Replies are listed 'Best First'.
Re^3: Module Naming Dilemma
by jdporter (Paladin) on Jan 04, 2005 at 22:19 UTC
    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.
Re^3: Module Naming Dilemma
by ikegami (Patriarch) on Jan 04, 2005 at 22:33 UTC

    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.

Re^3: Module Naming Dilemma
by tilly (Archbishop) on Jan 05, 2005 at 08:03 UTC
    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.

        I was assuming that you were just assigning to a typeglob to get the function created, in which case the appropriate typeglob manipulation would either put that in the wrong package or would need extra logic.

        I guess that you either did it differently than I expected, or you have the necessary extra logic.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found