Perl module version checking

Kralidis,Tom [Burlington] Tom.Kralidis at EC.GC.CA
Fri Nov 17 22:59:43 EST 2006


 
I discussed this with Ari (cc'd), and seems the way to make this happen
is to insert:

$VERSION = 4.10.0;

...in mapscript.pm

So, if the process for building perl mapscript is:

- cd mapscript/perl/
- run swig (outputs mapscript.pm)
- perl Makefile.PL
- make
- make install

Then mapscript/perl/Makefile.PL is where this logic should exist.

I have locally edited mapscript/perl/Makefile.PL with the following,
starting at line 38:

open(FH, "+<mapscript.pm") or die "mapscript.pm doesn't exist.  You must
run swig to create mapscript.pm first.  See README for more
information\n";
@array = <FH>;
$array[10] = "\$VERSION = $ms_version;\n";
seek(FH,0,0) or die "Seeking: $!";
print FH @array or die "Printing: $!";
truncate(FH,tell(FH)) or die "Truncating: $!";
close(FH) or die "Closing: $!";

I've tried this and tested and it works fine.  Just wanting to confirm I
haven't overlooked anything before committing.

Cheers

..Tom




> -----Original Message-----
> From: UMN MapServer Developers List 
> [mailto:MAPSERVER-DEV at LISTS.UMN.EDU] On Behalf Of Steve Lime
> Sent: 16 November, 2006 11:35 AM
> To: MAPSERVER-DEV at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-DEV] Perl module version checking
> 
> I sounds useful to me. If not for other languages then 
> perhaps this could be done through the plmodule.i interface 
> file. This must be done fairly often and documented someplace 
> on the Swig website.
> 
> Steve
> 
> >>> "Kralidis,Tom [Burlington]" <Tom.Kralidis at EC.GC.CA> 11/15/2006
> 2:18:57 PM >>>
> Hi,
> 
> Mapscript defines MS_VERSION to derive the version of 
> mapscript used (i.e. 4.10.0, etc.).
> 
> Perl language allows for specifying modules by version, i.e.:
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> use mapscript 4.10.0;
> 
> Perl language processes this by checking the version 
> specified against the VERSION variable used to identify Perl modules.
> 
> When attempting the script snippet above, the result is:
> 
> mapscript does not define $mapscript::VERSION--version check 
> failed at proxim2prop.pl line 9.
> BEGIN failed--compilation aborted at foo.pl line 9.
> 
> I have run into a couple of situations where version checking 
> like this is required.
> 
> Suggest we add a VERSION variable to mapscript.pm.  I think 
> it would be valuable given the issue above, and especially 
> since it is Perl idiom to do so.
> 
> Comments?
> 
> ..Tom
> 



More information about the mapserver-dev mailing list