[Purdue-pm] Question about Versions
Bradley Andersen
bradley.d.andersen at gmail.com
Wed Jul 9 15:23:45 PDT 2014
ok - i'm now officially a maintainer on only.pm - it just so happens ingy
wants to start giving it some love.
so, if you want to try it out, and you have issues, it *is* now going to be
getting some attention.
/bda
On Wed, Jul 9, 2014 at 3:00 PM, Mark Senn <mark at ecn.purdue.edu> wrote:
> > In Javascript, when I include a library I wrote, I put <script
> > src="bulldada_0.1.js"> and if I want to work on the module and make
> > changes, I can do that to bulldada_0.2.js, and I can change the HTML
> > when and if I'm ready to use 0.2. Theoretically, I can have a directory
> > full of bulldada_*.*.js.
> >
> > The capabilities are almost there with Perl. I can specify a version in
> my
> > module:
> > package Bull::Dada ;
> > our $VERSION = 0.01 ;
> > 1
> >
> > I can specify a version number in my code;
> > use strict ;
> > use lib '/home/jacoby/lib' ;
> > use Bull::Dada 0.01 ;
> >
> > But, Bull::Dada, as I understand it, has to be
> > /home/jacoby/lib/Bull/Dada.pm. I couldn't have it be
> > /home/jacoby/lib/Bull/ Dada_0.01.pm alongside Dada_0.02.pm, where I'm
> > changing the subroutines around and such, but I'm not ready to use it in
> > real code, or perhaps it uses OAuth 2.0 while 0.01 uses OAuth 1.0 or
> > whatever.
> >
> > To my knowledge, I cannot do this in Perl, as much as I may desire it.
> Am I
> > wrong?
>
> You can do it just like with the .js files. Just name them differently,
> say, Dada001.pm and Dada002.pm. As far as I know there is nothing in the
> Perl 5.20 core that will do what you want where a module name and version
> number map to a unique file name.
>
> Or, do something like this, here is the t.pl file:
>
> #!/usr/new/bin/perl
> #
> # /usr/new/bin/perl --version
> # prints
> # This is perl 5, version 20, subversion 0 (v5.20.0)
> # built for x86_64-linux-thread-multi
> #
>
> use Modern::Perl;
>
> # Use one of the following two lines.
> # I link this because it it's pretty staightforward and
> # isn't too much action at a distance.
> use lib qw(./Testing ./Production ./NeededForBoth);
> # use lib qw(./Production ./Testing ./NeededForBoth);
>
> use MyPackage;
> PrintWhich;
>
> Here is Testing/MyPackage.pm:
>
> # ./Testing/MyPackage.pm
>
> package MyPackage;
>
> use feature 'say';
>
> use Exporter;
>
> our @ISA = qw/Exporter/;
> our @EXPORT = qw/&PrintWhich/;
> our @EXPORT_OK = qw//;
> our %EXPORT_TAGS = ();
> our $VERSION = 0.02;
>
> sub PrintWhich
> {
> say 'Testing';
> }
>
> 1
>
> And here is Production/MyPackage.pm
>
> # ./Production/MyPackage.pm
>
> package MyPackage;
>
> use feature 'say';
>
> use Exporter;
>
> our @ISA = qw/Exporter/;
> our @EXPORT = qw/&PrintWhich/;
> our @EXPORT_OK = qw//;
> our %EXPORT_TAGS = ();
> our $VERSION = 0.01;
>
> sub PrintWhich
> {
> say 'Production';
> }
>
> 1
>
> Or, you could invoke the packages with names in an index that
> get take the module name and the version number and map that
> into a filename. I wouldn't do that though, just another thing
> to worry about. For me it is easier to think about Perl
> modules if they exist in one directory will be used before
> any that exist in other directories.
>
> -mark
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> http://mail.pm.org/mailman/listinfo/purdue-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/purdue-pm/attachments/20140709/6d23af5c/attachment.html>
More information about the Purdue-pm
mailing list