[mapserver-users] perl errorObj

Andy Colson andy at squeakycode.net
Tue May 1 06:50:28 PDT 2012


I have noticed a problem with the errorObj mapserver/mapscript/swig/perl 
object.

Its treated as an array, the generated code to get the message looks 
like this:

     arg1 = (errorObj *)(argp1);
     result = (char *)(char *) ((arg1)->message);
     {
       size_t size = 2048;

       while (size && (result[size - 1] == '\0')) --size;

       ST(argvi) = SWIG_FromCharPtrAndSize(result, size); argvi++ ;
     }

When I log errors:
my $errObj = new mapscript::errorObj();
while ($errObj)
{
    $s .= "ERROR: 
$errObj->{code}:$errObj->{message}:$errObj->{routine}<br>";
    $errObj = $errObj->next();
}

I get the message, but then huge amounts of garbage data as well.


In plmodule.i I tried to add a typemap:

%typemap(memberout) char[ANY] {
     $result = newSVpvn($1, strlen($1));
     argvi++;
}


But it doesn't seem to work, the generated code is exactly the same as 
it was before.  (I'm new to mapscript and swig, so I'm just guessing)

Any help or hints on how I might fix this?

Thanks,

-Andy



More information about the MapServer-users mailing list