[ic] instant reparse? still not working, about to go crazy

Marc Brevoort interchange-users@icdevgroup.org
Thu Feb 20 06:33:00 2003


On Wed, 2003-02-19 at 20:33, Kevin Walsh wrote:
> Marc Brevoort [marc.brevoort@armazemdedados.com] wrote:
> >
> > I'm normally not in the habit of using named parameters
> >
> You should use them.  Take the following example from one of your
> articles, where $url and $params are initialised from CGI:
> 
>     [posttourl $url $params]
> 
> If $url is blank then the $params value will be the first in the
> positional list.  If $url somehow managed to contain a space then
> it would take up the first and second positional parameter.  This
> sort of thing could turn out to be difficult to debug.

Very good point. Regarding ITL, consider me converted to named
parameters from now on. Anything that can prevent unpredictable and
unwanted behaviour is always welcome.

Speaking about unpredictable behaviour, I'm slowly going crazy here.

I've reduced the situation to the following.
Given the following result page:

<html>
<body>
<h1>Result</h2>
[perl]
        my $page="";
        $c007=$Session->{PayReference};
        if ($c007 eq "") {
                $page.="Session var. lost, cannot continue.";
                die();
        } else {
                $page.="Payment reference: $c007<br>\n";
                $CGI->{url}="https://cer.pnet.multibanco.pt/pvtn";
               
$CGI->{params}="A030=M020&A001=1266&C007=".$c007."&C013=";
                $page.="Connecting to
".$CGI->{url}."?".$CGI->{params}."<br>\n";        }
        return $page;
[/perl]
[parsexml]<ABC>556</ABC>[/parsexml]
[tmp hide]
[parsexml][posttourl url="[cgi url]" params="[cgi params]"][/parsexml]
[/tmp]
Result=[cgi C016], ABC=[cgi ABC]
</body>
</html>

And the following (formerly) XML parser tag, after lots of simplifying:

Usertag parsexml hasEndTag
Usertag parsexml Routine <<EOR
sub {
my ($xml)=@_;
my $result="";
sub cleanupxml {
my ($xml)=@_;
$result.="-----------------------cleanup-------------";
        return $xml;
}
my $cleanxml=cleanupxml($xml);
$result.="<br>".$cleanxml."<br>\n";
return $result;

}
EOR

The result that I get in my browser is:

Result
Payment reference: 0009900211
Connecting to
https://cer.pnet.multibanco.pt/pvtn?A030=M020&A001=1266&C007=0009900211&C013=
-----------------------cleanup-------------
556
Result=2, ABC= 

I would expect the text '-------cleanup---------' to appear twice, after
all I'm calling the [parsexml] tag twice, right? 

Also, when running things in Mozilla, the 'connecting to' link is not
shown, while in Galeon it is; the error log shows that using mozilla the
session variable is lost, though the html is server-generated and thus
shouldn't be browser-dependant. In either case, I'd still expect two
attempts to parse the xml.

Am I just too short on coffee not to see what's happening, or is
something weird going on? Any clues?

Thanks,

Marc Brevoort
-- 
e-mail:	marc.brevoort@armazemdedados.com
web:	http://www.armazemdedados.com

Armazem de Dados, Informatica, Lda
Dep. Desenvolvimento
Tel. +351 21 910 83 10 / Fax. +351- 21 910 83 19