[mapserver-users] Re: Perl/mapscript error
Giorgio Volpe
giorgio at nauta.it
Sun Apr 28 08:24:08 PDT 2002
Puneet Kishor wrote:
>
> ok... I have spent a good part of today battling this, and have
> discovered the following...
>
> one of the reasons I am getting these errors because I have -w switch on
> my shebang line. After much finagling, I can get the image to draw, but
> with the -w switch I get the following error as well --
>
> (in cleanup) Not a HASH reference at /Library/Perl/darwin/mapscript.pm
> line 1468.
>
> that line in mapscript.pm is the one that is trying to clean up... and
> failing. Specifically,
>
> sub DESTROY {
> my $self = tied(%{$_[0]});
> delete $ITERATORS{$self};
> if (exists $OWNER{$self}) {
> mapscriptc::delete_mapObj($self);
> delete $OWNER{$self};
> }
> }
I've the same problem!
It is not a warning but a fatal error for perl.
The problem, i guess, is related to the use of tied hash to support
mapscript objects ...
I've added a PRINT ...
sub DESTROY {
print STDERR "!!!! Destroing $_[0] ...\n";
my $self = tied(%{$_[0]});
...
The DESTRUCTOR is called two times! The first one with $_[0] that is a
reference to an hash, the second to a scalar so function "tied" raises
the error!
!!!! Destroing layerObj=HASH(0x83e925c) ...
!!!! Destroing layerObj=SCALAR(0x83d8ef4) ...
Empirically i've seen that, if I undef the variable containing the
reference to the object before returning from the sub where i use it,
than the error disappears ... (also if the two call to the DESTRUCTOR
are always there, but probably the undef value is passed)
We need a PERL guru ...!
--
Giorgio
-----------------------------------------
More information about the MapServer-users
mailing list