[mapserver-users] Couldn't run perl mapscript under Apache

Lowell Filak lfilak at medinaco.org
Mon Nov 18 05:47:01 PST 2002


Those two messages are just warnings and do not keep the script from working properly unless you are running mod_perl or use strict.
After you ran the script at the command line you should have had an images/test.png file created at the same time.
Did you?
If you open it in your browser does it look like what you expected?
Note that when you ran it at the command line you should have seen the html header, start tag, & end tag printed to the screen also.
Did you?
Puneet is correct in that your script still doesn't contain start_html or end_html.
Lowell F.

The following message was sent by "krung" <krung at cad.go.th> on Mon, 18 Nov 2002 13:25:42 +0700.

> Puneet,
> 
> Sorry, It's my mistake. I mistyped from 'use CGI qw/:standard/;' to 'use DBI qw/:standard/;' in mail message but not in my real script. I tried as you suggested me. The same situation took place as before. But for now, when I ran the script at command line. Some warnings appeared below:
> 
> [Sun Nov 17 07:46:39 2002] testmap.pl (in cleanup) Not a HASH reference at /usr/lib/perl5/site_perl/5.6.1/i386-linux-thread-multi/mapscript.pm line 1144.
> [Sun Nov 17 07:46:39 2002] testmap.pl (in cleanup) Not a HASH reference at /usr/lib/perl5/site_perl/5.6.1/i386-linux-thread-multi/mapscript.pm line 2415
> 
> I checked for these lines of warning. It's sub DESTROY of image object and map object respectively. How do I have to do next? And another question, why a few days ago these warning messages didn't show (also with switch -w) though I didn't change anything with my system.
> 
> Thanks.
> Krung.
> 
> ---------- Original Message ----------------------------------
> From: Puneet Kishor <pkishor at geoanalytics.com>
> Date:  Fri, 15 Nov 2002 09:14:46 -0600
> 
> >
> >On Thursday, November 14, 2002, at 11:24  PM, krung wrote:
> >
> >> Lowell.
> >>
> >> My script is very simple below;
> >>
> >> #!/usr/bin/perl -w
> >> use mapscript;
> >> use DBI qw/:standard/;
> >>
> >> print header();
> >> $map = new mapObj("test.map") or die "couldn't open map file\n";
> >> $img = $map->draw();
> >> $img->saveImage("images/test.png", $mapscript::MS_PNG,1,1,0);
> >> print "<IMG SRC=\"images/test.png\">";
> >>
> >>
> >
> >try this...
> >=====================
> >#!/usr/bin/perl -w
> >
> ># 1. import the modules
> >use CGI::Pretty qw(:standard);
> >use CGI::Carp qw(fatalsToBrowser);
> >use mapscript;
> >use DBI qw(:standard);
> >
> ># 2. set dir and url paths
> >my $apppath = "/absolute/path/to/your/tmp/dir";
> >my $appurl = "/url/to/your/tmp/dir";
> >
> ># set your mapfile
> >my $mapfile = "/absolute/path/to/your/mapfile";
> >
> ># create a new map object
> >my $map = new mapObj("$mapfile") or die $mapscript::ms_error->{message};
> >
> ># set a tmp map image name
> >my $imgname = $map->{name} . time() . ".png";
> >
> ># create the map
> >my $img = $map->draw() or die('Unable to draw map');
> >
> ># save the map
> >$img->saveImage($apppath . $imgname, $map->{imagetype}, 
> >$map->{interlace}, $map->{transparent}, $map->{imagequality});
> >
> ># 3. output
> >print header, start_html;
> >print "<img src=$appurl/$imgname>";
> >print end_html;
> >=====================
> 




More information about the MapServer-users mailing list