2014/07/09

Question about versioning with Perl modules

My main two languages are Perl and Javascript, and I've been coding them here for several years. This means that I have a body of code I'm perpetually updating and maintaining old code. And, while I am shamed to admit this, I test in production, I dev in production, and until we change our infrastructure, I don't see that changing any time soon.

In Javascript, there is a capability that I've found I like.

<script src="/lib/bulldada-0.0.1.js">

This means if I want to play around with rewriting bulldata, I can copy and poke at bulldada-0.0.2.js, and change the script tag to call for 0.0.2 when I'm happy with it. This means I am developing with the production server, but not necessarily with production tools. This makes me happy.

Let's think about Perl. In my programs, I can specify a version:

use BullDada 0.01 ;

In my modules, I can set that version:

package BullDada ;
our $VERSION = 0.01 ;
1;

Question is, how to have multiple modules with the same name in the same directory structure? By testing with Perl 5.18, I know that you can't have BullDada_0.1.pm and BullDada_0.2.pm, both starting with package Bulldada, and expect it to work. It seems that if I wanted to keep programs from using BullDada.pm with $VERSION = 0.01, I could specify BullDada 0.02, but I could also delete the old version and never use versioning at all.

Unless I'm doing it wrong. I'm willing to grant I'm doing it wrong. If there is a way to do it right, what is it?
Post a Comment