Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Renaming CPAN modules

by b10m (Vicar)
on Oct 27, 2006 at 21:02 UTC ( [id://581019]=perlquestion: print w/replies, xml ) Need Help??

b10m has asked for the wisdom of the Perl Monks concerning the following question:

Brethren,

I've been mainting a CPAN module called Business::TPGPost, which will calculate the shipping cost based on TPG Post (Dutch postal service) rates for some time. Recently, the company changed it's name from TPG Post to TNT Post.

Since the rates will most likely be updated per January 1st, I'll be updating it, like a good CPAN user is supposed ;-) But, should I rename my module to Business::TNTPost, or even Business::TNT::NL, or keep the old name? How do other CPAN authors handle namechanges like this?

I can see where a namechange would be preferred for new users, but would "older users" (if they exist at all) be aware of this name change?

--
b10m

All code is usually tested, but rarely trusted.

Replies are listed 'Best First'.
Re: Renaming CPAN modules
by kwaping (Priest) on Oct 27, 2006 at 21:15 UTC
    I'm not sure how acceptable this is for CPAN, but you could write a thin wrapper for your Business::TPGPost module called Business::TNTPost. You would then keep the original module updated under the original name, but new users could still find and use the new one via the new name (with Business::TPGPost being a dependancy).

    ---
    It's all fine and dandy until someone has to look at the code.

      I would actually recommend doing the inverse. Write the new Business::TNTPost (or whatever name you most like, company agnositc is best to avoid this same issue in the future), and then re-write Business::TPGPost to be a wrapper around it.

      My reasoning is that the TNTPost is the new name, and so is the "future" of this module. While the TPG is the "past" and should eventually be deprecated.

      -stvn
Re: Renaming CPAN modules
by Bro. Doug (Monk) on Oct 28, 2006 at 15:45 UTC
    The biggest problem with renaming your modules is, of course, the many references made to your module throughout your code. It's usually a fairly morbid experience to grep through thousands of lines of code and make sure all names are correctly changed. Global search and replace makes this easier, but the problem can be pre-empted in initial development.

    my $pkg = "My::Package" ; eval "use $pkg ;" #you can also reference the package base class from a var my $obj = $pkg->new ;


    Now you can easily change the package names just by changing the definition of $pkg.

    I hope that helps.

    Bro. Doug :wq

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://581019]
Approved by grep
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (9)
As of 2024-03-28 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found