versioning a core module? 
Author Message
 versioning a core module?

I'd like to use Math::Big<Int|Float> (henceforth 'Big*') for a module
I'm writing, eventually hopefully to become Math::Format. I'd like to
use this with courseware on which I work, for use with formatting
integers, floats, and scientific notation, esp wrt significant digits.

Big* are core modules since, I believe, 5.002. They are also being
rewritten: the version in 5.6.1 has major patches, and Tels is working
on even newer versions at

http://www.{*filter*}gate.com/perl/#math

which I'd like to use, since it has useful functionality.

Unfortunately my code must run on a large university system over which
I have little control. I can usually get packages added to
.../site-perl, but I can't touch the main distribution. In fact, the
perl which my university's IT dept "supports" is still 5.005_03 :-(
but that's another issue.

What I'd like to know is: can I diddle my code so as to ensure it
gets the newer versions of Big*, while ensuring that others continue
to access the core-shipped modules "normally"?

Specifically: suppose Joe User has

JU> use Math::BigFloat;

in his/her code. If I put Big* v1.24 in

.../site-perl/Math/

and then write code which has

TR> use Math::BigFloat 1.24;

will Joe User's code continue to work correctly? and will mine work
correctly? Or is there something else I need to do?

I suppose I could instead do something like

* copy BigFloat.pm v1.24 to .../site-perl/Math/NewBigFloat.pm

* change all references to 'Math::BigFloat' in Big* to
  'Math::NewBigFloat'

* make my code do

TR> use Math::NewBigFloat 1.24;

but that's a little _too_ kludgey :-) I'm hoping there's a better way.

Please reply directly to me as well as the group, and TIA,



Mon, 29 Sep 2003 02:45:55 GMT  
 versioning a core module?

Quote:

> What I'd like to know is: can I diddle my code so as to ensure it
> gets the newer versions of Big*, while ensuring that others continue
> to access the core-shipped modules "normally"?

You should be aware that perl modules can go anywhere;
it's just a matter of getting perl to find them.
So, unless there's a global directory you have write
permission to, put them in a directory of your own,
and make it world-readable. Then let perl know to look
there.  The basic way is

  use lib '/my/home/dir/perl/lib'; # whatever is correct

This can be achieved by the -I command line switch:

  perl -I/my/home/dir/perl/lib

and finally, you can put it in your PERL5LIB environment
variable:

  PERL5LIB=/my/home/dir/perl/lib

If you set this in your shell's startup script, then
it's as if perl always knows about your personal lib
directory.  It even gets displayed in perl -V.

--
John Porter

Any technology distinguishable from magic is insufficiently advanced.



Mon, 29 Sep 2003 03:02:06 GMT  
 versioning a core module?

Quote:

>> What I'd like to know is: can I diddle my code so as to ensure it
>> gets the newer versions of Big*, while ensuring that others
>> continue to access the core-shipped modules "normally"?


Quote:
> put them in a directory of your own, and make it world-readable.
> Then let perl know to look there. The basic way is
>   use lib '/my/home/dir/perl/lib'; # whatever is correct

OK. On my own workstation I have

`perl -v`

Quote:
> This is perl, v5.6.0 built for MSWin32-x86
> Copyright 1987-2000, Larry Wall

and

d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math

Quote:
> total 162
> drwxrwxrwx   2 tlroche  5               0 Oct 10  2000 ..
> drwxrwxrwx   2 tlroche  5               0 Aug 19  2000 .
> -r--r--r--   1 tlroche  5           52239 Apr  7 03:25 BigInt.pm
> -r--r--r--   1 tlroche  5           27526 Apr  7 03:26 BigFloat.pm
> drwxrwxrwx   2 tlroche  5               0 Jun 17  2000 Cephes
> -r--r--r--   1 tlroche  5          111939 Apr  1  2000 Cephes.pod
> -r--r--r--   1 tlroche  5            2370 Apr  1  2000 Cephes.pm
> -r--r--r--   1 tlroche  5           37291 May 19  1999 Random.pm
> -r--r--r--   1 tlroche  5           13948 May 18  1999 example.pl

and I have a test driver

h:/WebAssign/testBig.pl

Quote:
> use lib 'd:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math';

# use Math::BigInt;
# use Math::BigFloat;

Quote:
> use Math::BigInt 1.23;
> use Math::BigFloat 1.23;
> print("\n");

When I compile, I get

Quote:
> cd h:/WebAssign/
> perl -cw testBig.pl
> Math::BigInt version 1.23 required--this is only version 0.01 at
> testBig.pl line 4.
> BEGIN failed--compilation aborted at testBig.pl line 4.
> Compilation exited abnormally with code 255 at Wed Apr 11 17:12:29

I.e. perl is only seeing the core module. (Note that the core
Math::BigInt is now version 0.01 only because I copied the version
shipping with 5.6.1 into my .../5.6.0/lib/Math/: it was not versioned
before 5.6.1.

d:/ProgramFiles/Perls/GNU/5.6.0/lib/Math/BigInt.pm

Quote:
> package Math::BigInt;
> $VERSION='0.01';

) Changing to

Quote:
> use lib 'd:\\ProgramFiles\\Perls\\GNU\\site\\5.6.0\\lib\\Math';

makes no difference.


Quote:
> This can be achieved by the -I command line switch:
>   perl -I/my/home/dir/perl/lib

Compiling with -Id:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math
makes no difference:

Quote:
> cd h:/WebAssign/
> perl -Id:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math -cw testBig.pl
> Math::BigInt version 1.23 required--this is only version 0.01 at
> testBig.pl line 5.
> BEGIN failed--compilation aborted at testBig.pl line 5.
> Compilation exited abnormally with code 255 at Wed Apr 11 17:22:42


Quote:
> and finally, you can put it in your PERL5LIB environment
> variable:
>   PERL5LIB=/my/home/dir/perl/lib

Compiling with
set PERL5LIB=d:\ProgramFiles\Perls\GNU\site\5.6.0\lib\Math
makes no difference:

Quote:
> H:\WebAssign>set PERL5LIB=d:\ProgramFiles\Perls\GNU\site\5.6.0\lib\Math
> H:\WebAssign>perl -cw testBig.pl
> Math::BigInt version 1.23 required--this is only version 0.01 at
> testBig.pl line 5.
> BEGIN failed--compilation aborted at testBig.pl line 5.




Mon, 29 Sep 2003 05:32:58 GMT  
 versioning a core module?

Hello Tom,

Quote:
>d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math
>h:/WebAssign/testBig.pl
>> use lib 'd:/ProgramFiles/Perls/GNU/site/5.6.0/lib/Math';
>> use Math::BigInt 1.23;

Perl is looking for a file named 'BigInt.pm' in the subdir 'Math' in

use lib 'd:/ProgramFiles/Perls/GNU/site/5.6.0/lib/'

Regards,
 Christian



Wed, 01 Oct 2003 00:49:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 2nd DataModul makes DB performance slow !?

2. TTable component

3. Delphi 16 install bites Paradox 7??

4. File records ...

5. How to show what I've found?

6. module versioning - coexistence of multiple versions

7. Module Versioning style advice?

8. RFC: File Versioning Module

9. Module Versioning question

10. Carp.pm and CGI::Carp.pm versioning questions

11. ActiveState Perl and versioning

12. ISA versioning

 

 
Powered by phpBB® Forum Software