[Mapserver-users] Problem: processTemplate()

Janett Jahn jjahn at et-inf.fho-emden.de
Wed Feb 18 06:23:04 EST 2004


I have a problem when I am using the processTemplate() function from perl 
mapscript. 
 
The function returns : 
 
Type error in argument 3 of mapObj_processTemplate. Expected _p_pchar at 
./myfile.pl line 42. 
 
my code : 
 
my @tnames = keyes(%tags); 
my @tvalues = values(%tags); 
 
my $temp = 
$map->processTemplate($mapscript::MS_TRUE,\@tnames,\@tvalues,$#tnames +1); 
 
I know that there was the same question on 09.08.2002 and I read the answer 
(10.08.2002) too. 
I installed SWIG version 1.1 and append the lines to typemaps.i . 
When I run "swig -shadow -perl5 mapscript.i" I get many errors in mapscript.i. 
 
Then I removed SWIG version 1.1 and installed the newest (1.3.21). 
I appended these lines  and run swig again. Then I got 2 warnings : 
"Depracated typemap feature ($source/$target)..." 
 
I changed the lines as follows : 
 
 %module argv 
 
 // This tells SWIG to treat char ** as a special case 
 %typemap(perl5,in) char ** { 
 AV *tempav; 
 I32 len; 
 int i; 
 SV **tv; 
 if (!SvROK($input)) 
 croak("$input is not a reference."); 
 if (SvTYPE(SvRV($input)) != SVt_PVAV) 
 croak("$input is not an array."); 
 tempav = (AV*)SvRV($input); 
 len = av_len(tempav); 
 $1 = (char **) malloc((len+2)*sizeof(char *)); 
 for (i = 0; i <= len; i++) { 
 tv = av_fetch(tempav, i, 0); 
 $1[i] = (char *) SvPV(*tv,PL_na); 
 } 
 $1[i] = 0; 
 }; 
 
 // This cleans up our char ** array after the function call 
 %typemap(perl5,freearg) char ** { 
 free($input); 
 } 
 
 // Creates a new Perl array and places a char ** into it 
 %typemap(perl5,out) char ** { 
 AV *myav; 
 SV **svs; 
 int i = 0,len = 0; 
 /* Figure out how many elements we have */ 
 while ($1[len]) 
 len++; 
 svs = (SV **) malloc(len*sizeof(SV *)); 
 for (i = 0; i < len ; i++) { 
 svs[i] = sv_newmortal(); 
 sv_setpv((SV*)svs[i],$1[i]); 
 }; 
 myav = av_make(len,svs); 
 free(svs); 
 $result = newRV((SV*)myav); 
 sv_2mortal($result); 
 } 
 
After that I run swig again and there were no errors or warnings and so I 
compiled the perl- mapscript. 
But I still get the same error, when I try to run my perlsript. 
 
Can someone help me ??? 
 
(sorry for my bad english) 
 
 
 

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



More information about the mapserver-users mailing list