develooper Front page | perl.perl6.language | Postings from June 2005

PGE error?

Thread Next
From:
=?ISO-8859-2?Q?B=C1RTH=C1ZI_Andr=E1s?=
Date:
June 10, 2005 01:29
Subject:
PGE error?
Message ID:
42A94F5D.9080705@barthazi.hu
Hi,

I don't know what happens and where in the code, but... Anyway, it's 
strange... I have this code and input.tpl:

--------------- 8< -------------------

rule sp {
     <[ ]>
}

rule id {
     <[a..z]><[a..z0..9]>+
}

sub do($match) {
     say $match[0];
     return "+";
}

my $template=slurp('input.tpl');

$template ~~
     s:g!
     [ \< server \: (<id>) [<sp>+ $?id:=(<id>) <sp>*=<sp>*"(<-["]>*)"]* 
<sp>* \> (.*?) \<\/ server \: $0 \> ]
     |
     [ \< server \: (<id>) [<sp>+(<id>)<sp>*=<sp>*"(<-["]>*)"]* <sp>* \/\> ]
     !{ do($/) }!;

say $template;

--------------- 8< -------------------

text

<server:foo />

<server:huh />

text

<server:boo> inside <server:huh /> inside </server:boo>

text

--------------- 8< -------------------

Running it several times, one time works: matches and replaces </> 
things to +-es, one time it not works... Randomly. Where should I send 
these kind of bugs?

Bye,
   Andras

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About