Bus error -- Re: [mapserver-users] Re: Perl/mapscript error

kenboss kenboss at dilbert.dnr.state.mn.us
Fri May 3 15:56:32 EDT 2002


FWIW--

I have been experiencing variants of this problem as well -- I assume you folks 
are using 3.6?  My application dictates logic something like:

sub processData {
  $map = new mapObj(undef);
  $layer = new layerObj($map);
  ...
  while (<INPUTFILE>) {
    # do this that and the other
  }
}

When I do that, I get the "Not a HASH" type errors.  The script carries on, but 
the results are all wrong.

If I rearrange my logic to something less reasonable like:

sub processData {
  while (<INPUTFILE>) {
    $map = new mapObj;
    $layer = new layerObj($map);
    ...
    # do this that and the other
    undef $map;
  }
}

then my results come out right.  I am not a perl guru, sorry, this is all I 
know.

I had been discussing this with Steve Lime last week, but he's been traveling 
this week, he'll be back at work next week.  I wouldn't be surprised to see some 
sort of resolution shortly thereafter... :)

--Ken Boss

=============================================================================
Ken Boss                                
Digital Image Analysis / Web Stuff       Forestry Resource Assessment
kenboss at dilbert.dnr.state.mn.us          Minnesota Dept. of Natural Resources
Voice: 218 327 4449 ext. 237             413 SE 13th Street                 
Fax:   218 327 4517                      Grand Rapids, MN  55744          USA
                   www.ra.dnr.state.mn.us
=============================================================================





> > 
> > I think that an error in "eval( $perl )" results in an error 
> > in the perl script whereas an error in "eval( "$perl" )" 
> > results in an error in the eval and should not bomb the 
> > script while "eval( $perl )" could bomb the script but 
> > shouldn't in the case of "Not a HASH..." because it's just a 
> > warning. More ellaboration on that may need to go to a perl list.
> > The source of all of this (which you've already identified) 
> > is something that may need cleared up as Puneet suggests, if 
> > it's creating that much of a problem.
> 
> 
> 
> definitely needs to be cleared up. While I can apply patches Giorgio-style,
> that is definitely not a clean solution.
> 
> 
> in my case the script bombs completely. I wish I could correct this myself,
> but I am still teething as far as Perl is concerned. Perl fascinates me
> utterly and completely, but it will be a long while before I will come close
> to solving the above kind of problems.
> 
> I don't know who the original author of Perl/Mapscript is... I am assuming
> it is Steve Lime. Any comments, Steve?
> 
> pk/
> 
> 
>  
> 
> 
> 
> 
> 
> > Lowell F.
> > 
> > The following message was sent by Giorgio Volpe 
> > <giorgio at nauta.it> on Thu, 02 May 2002 15:36:01 +0200.
> > 
> > > I've discovered, after many hours, that the problem is 
> > related, in my
> > > case, to the fact that the sub raising the error on its 
> > return (clean
> > > up) is called in an "eval" and the result of the call is 
> > than stored as
> > > returned from eval ...
> > > 
> > > 	@res=eval( $perl )
> > > after this, $@ contains "Not a HASH reference at
> > > /usr/local/lib/perl/5.6.1/mapscript.pm ..."
> > > 
> > > if I change it to:
> > > 
> > > 	@res=eval( "my \@r=$perl;return \@r" )
> > > 
> > > error disappears!
> > > Is it a scope related problem? A little perl confusion?
> > > 
> > > (if this can be of any neaning for someone, $perl contains a complex
> > > reference to an object that is in an other package ... like
> > > $me->{binded_obj}->method_causing_error()  )
> > > 
> > > 
> > > 
> > > -- 
> > > 
> > >     Giorgio
> > > 
> > > -----------------------------------------
> > 




More information about the mapserver-users mailing list