Perl module version checking

Kralidis,Tom [Burlington] Tom.Kralidis at EC.GC.CA
Tue Nov 21 08:21:40 EST 2006


Chec out section 26.4.3.  This is essentially what we want to do,
defining VERSION (equal to MS_VERSION).  I tried setting:

#define VERSION MS_VERSION

...which didn't work (after re-swigging things, perl Makefile.PL, make).



> -----Original Message-----
> From: Ari Jolma [mailto:ari.jolma at tkk.fi] 
> Sent: 21 November, 2006 1:42 AM
> To: Kralidis,Tom [Burlington]
> Cc: Steve Lime; MAPSERVER-DEV at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-DEV] Perl module version checking
> 
> Kralidis,Tom [Burlington] kirjoitti:
> > I know.  I've yet to find anything to achieve this in swig. 
>  Perhaps 
> > Ari
> > (cc'd) can confirm.
> >   
> 
> Swig supports different languages differently. Currently swig 
> has some support for inserting Perl into the .pm files
> http://www.swig.org/Doc1.3/Perl5.html#Perl5_nn47
> 
> I'd also like to know how this could be exploited. There are 
> things that I'd like to insert into GDAL/OGR modules.
> 
> Ari
> 
> > ..Tom
> >
> >   
> >> -----Original Message-----
> >> From: UMN MapServer Developers List
> >> [mailto:MAPSERVER-DEV at LISTS.UMN.EDU] On Behalf Of Steve Lime
> >> Sent: 20 November, 2006 1:37 PM
> >> To: MAPSERVER-DEV at LISTS.UMN.EDU
> >> Subject: Re: [UMN_MAPSERVER-DEV] Perl module version checking
> >>
> >> It seems a bit hacky, which may be a good thing. I thought 
> Swig had a 
> >> method for including scripting language code directly into 
> the module 
> >> to achieve the same result. Don't know if it's worth investigating.
> >>
> >> Steve
> >>
> >>     
> >>>>> "Kralidis,Tom [Burlington]" <Tom.Kralidis at EC.GC.CA> 11/17/2006
> >>>>>           
> >> 9:59:43 PM >>>
> >>  
> >> 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
> >>>
> >>>       
> 
> 
> --
> Prof. Ari Jolma
> Geoinformaatio- ja paikannustekniikka
> Geoinformation and positioning technology Teknillinen 
> Korkeakoulu / Helsinki University of Technology POBox 1200, 
> 02015 TKK, Finland
> Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma
> 
> 



More information about the mapserver-dev mailing list