[Mapserver-users] Problems with PerlMapscript 3.7 Syntax

Lowell Filak lfilak@medinaco.org
Thu, 01 May 2003 15:17:01 -0400


Not that I know for certain but I think saveImage was a carry-over from pre-3.6 pertaining to msSaveImage then in 3.6 the imageObj was born but the method was left as "saveImage" where a "save" method on an imageObj would make the naming convention more consistent & be less redundant, ie. mapObj->save.
Not that I'm saying it isn't a bother to rewrite things to work with the latest release but it may make sense to be consistent.
Just my theory.
Lowell F.

The following message was sent by Joe Bussell <joe@otsys.com> on Thu, 01 May 2003 11:23:02 -0700.

> Is it just me, or does this function renaming seem unnecesary?  I fully 
> understand fixing up the internal code.  I do not accept that making 
> function call naming changes from distinctly articulated names like 
> "saveImage()" to its ambiguously named alternative "save()" is at all 
> productive.
> 
> Could you explain to me the reason that this particular name was 
> changed?  Can we agree on a stable interface and concentrate on the real 
> buisiness of the day?
> 
> Cordially,
> 
> Joe Bussell
> On Time Systems
> www.trafficdodger.com
> 
> 
> Sean Gillies wrote:
> > Babak,
> > 
> > The function you're looking for is save(), not saveImage().
> > 
> > To find out what functions are current in MapScript, you need to
> > look in the mapscript.i file.  The documentation is far behind
> > development.
> > 
> > To find all symbols in a package, do something like what's
> > illustrated on page 281 of Programming Perl, 2nd edition:
> > 
> > foreach $symname (sort keys %main::) {
> >     ...
> > }
> > 
> > Hope this helps,
> > Sean
> > 
> > On Thursday, May 1, 2003, at 08:34  AM, Babak Toloue Tehrani wrote:
> > 
> >> Hello,
> >>
> >> I have still problems with perlmapscript 3.7. The demo below with the
> >> syntax of perlmapscript 3.6 is working very fine on my system. shp2img
> >> is also working for the mapfile below.
> >>
> >>> From the WIKI MigrationGuide I Take the syntax for saveImage():
> >>
> >>
> >> $img->saveImage('test37.png');
> >>
> >> and get following output:
> >>
> >> Can't locate auto/mapscript/imageObj/saveImage.al in @INC (@INC
> >> contains: /usr/lib/perl5/5.8.0/i586-linux-thread-multi
> >> /usr/lib/perl5/5.8.0
> >> /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
> >> /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at test37.pl
> >> line 7
> >>
> >> Then I looked for the string saveImage in the mapscript.pm module and
> >> found the function msSaveImage who brings me following output:
> >>
> >> Usage: msSaveImage(map,img,filename); at test37.pl line 7.
> >>
> >> I tried: $map->msSaveImage($map,$img,'test37');
> >>
> >> and got same errormessage as before. Then I tried to set the set the
> >> ImageType with:
> >>
> >> map->setImageType("png") or die('Unable to setImageType.');
> >>
> >> and see that it failed. Here the script and the mapfile:
> >>
> >> (Does someone now a tool to extract from a perl Module (mapscript.pm) a
> >> list of all Classes/Objects, Members and Methods?)
> >>
> >> Thanks a lot,
> >>
> >> Babak
> >>
> >> ======================================================================= 
> >> ===
> >> #!/usr/bin/perl -w
> >> use mapscript;
> >> use strict;
> >>
> >> my $map = new mapscript::mapObj("data/demo37.map") or die('Unable to
> >> OPEN mapfile.');
> >> $map->setImageType("png") or die('Unable to setImageType.');
> >> my $img = $map->draw() or die('Unable to DRAW mapfile.');
> >> $map->msSaveImage($map,$img,'test37');
> >> $img->free();
> >> ----------------------------------------------------------------------- 
> >> ---
> >> NAME DEMO37
> >> STATUS ON
> >> SIZE 600 450
> >> EXTENT 5.3 55.5 15.5 46.9
> >> UNITS METERS
> >> SHAPEPATH "data"
> >> IMAGECOLOR 255 255 255
> >>
> >> OUTPUTFORMAT
> >>   NAME png
> >>   DRIVER "GD/PNG"
> >>   MIMETYPE "image/png"
> >>   IMAGEMODE PC256
> >>   EXTENSION "png"
> >> END
> >>
> >> LAYER
> >>   NAME TESTLAYER
> >>   TYPE POLYGON
> >>   STATUS DEFAULT
> >>   DATA lnd01dd.shp
> >>   CLASS
> >>       NAME TESTCLASS
> >>       SYMBOL 0
> >>       COLOR 195 195 195
> >>       OUTLINECOLOR 102 102 102
> >>   END
> >> END
> >> END
> >>
> >>
> > -- 
> > Sean Gillies
> > sgillies at frii dot com
> > http://www.frii.com/~sgillies
> > 
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users@lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > 
> 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users@lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users