Mailing List Archive

Differences Perl / Embperl
Hi all!

Just tried to process some XML-style data-parsing with HTML::Parser. For
that i created a (derived) class "PostboxParse.pm" with the appropriate
start/end/text methods so that the HTML::Parser could do some useful work.

Calling the Class from a Perl main program works well, calling the class
parses the string "chunk1" (like in the HTML::Parser example) and returns
the proper error codes or confirmations. Doing the same in perl delivers
only a class-generated "End" messsage but it looks like the
"chunk1" string isn't handed to the class-routines anyway :-(

The codepiece in Perl: (Works correct, delivering the correct result-strings)
======================
use PostboxParse;
$chunk1 = "<POSTBOX ACTION=UPDATE>soap\@foo.bar<PASSWORD></PASSWORD><FWADDR>soup\@blo.bli.blub.de</FWADDR></POSTBOX>";
my $p = PostboxParse->new(); # create a new object
$p->parse($chunk1); # parse the string
my $xx = $p->eof; # signal end of document
@aaa = $p->readmsg(); # get back the error-messages
foreach (@aaa){ # ... and print them
print "...>>>$_\n";
}
The codepiece in EmbPerl: (Returning only a hardwired "End"-messages )
========================
No html-Header is required - so everything is in [- ... -]

[.-
use PostboxParse;
$chunk1 = "<POSTBOX ACTION=UPDATE>soap\@foo.bar<PASSWORD></PASSWORD><FWADDR>soup\@blo.bli.blub.de</FWADDR></POSTBOX>";
my $p = PostboxParse->new(); # create a new object
$p->parse($chunk1); # parse the string
$xx = $p->eof; # signal end of document
@aaa = $p->readmsg(); # get back the error-messages
foreach (@aaa){ # ... and print them
print "...>>>$_\n";
}
-]

Perhaps i have overseen some trivial solution...

Thanks in advance
Ulrike
--
* NAMES: Ulrike Schepp Gigabell AG
* PHONE: [+49] [0]69 - 17084-742 D-60325 Frankfurt
* ENCR.: Key 0x5E34C939 B0 B1 ED D0 51 D1 0C 3B 82 23 2C 61 10 38 57 95
* SIGN : Key 0x59AFB1C5 59 5D 53 37 2F 79 A0 2F 27 03 F7 23 58 EE B9 6C
RE: Differences Perl / Embperl [ In reply to ]
> [.-
> use PostboxParse;
> $chunk1 = "<POSTBOX
> ACTION=UPDATE>soap\@foo.bar<PASSWORD></PASSWORD><FWADDR>soup\@blo.
> bli.blub.de</FWADDR></POSTBOX>";
> my $p = PostboxParse->new(); # create a new object
> $p->parse($chunk1); # parse the string
> $xx = $p->eof; # signal end of document
> @aaa = $p->readmsg(); # get back the error-messages
> foreach (@aaa){ # ... and print them
> print "...>>>$_\n";

You must print to OUT i.e.

print OUT "...>>>$_\n";

or use a [+ +] block instead

Gerald


> }
> -]
>


-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
RE: Differences Perl / Embperl [ In reply to ]
>
> Thanks for the quick answer Gerald - but that i have tried already - with
> no success :-(
>
> [+...+] Tags didn't work as well (bad) as output to OUT- Filedescriptor...
>
> It looks, like the $chunk1 string isn't handed over to the
> parser-subroutines at all.
>

Have you set the optRawInput in EMBPERL_OPTIONS ? You should always do this
if you write in an text editor, otherwise Embperl will strip out all your
HTML Tags from the string (or you have to correctly escape them as
&lt;POSTBOX&gt; etc.)

See the Faq.pod and the section "Inside Embperl for more details"

You should verify that $chunk1 contains the right data by putting a [+
$chunk1 +] at the end.

Gerald

> On Mon, 10 Apr 2000, Gerald Richter wrote:
>
> > > [.-
> > > use PostboxParse;
> > > $chunk1 = "<POSTBOX
> > > ACTION=UPDATE>soap\@foo.bar<PASSWORD></PASSWORD><FWADDR>soup\@blo.
> > > bli.blub.de</FWADDR></POSTBOX>";
> > > my $p = PostboxParse->new(); # create a new object
> > > $p->parse($chunk1); # parse the string
> > > $xx = $p->eof; # signal end of document
> > > @aaa = $p->readmsg(); # get back the error-messages
> > > foreach (@aaa){ # ... and print them
> > > print "...>>>$_\n";
> >
> > You must print to OUT i.e.
> >
> > print OUT "...>>>$_\n";
> >
> > or use a [+ +] block instead
>
> --
> * NAMES: Ulrike Schepp Gigabell AG
> * PHONE: [+49] [0]69 - 17084-742 D-60325 Frankfurt
> * ENCR.: Key 0x5E34C939 B0 B1 ED D0 51 D1 0C 3B 82 23 2C 61 10 38 57 95
> * SIGN : Key 0x59AFB1C5 59 5D 53 37 2F 79 A0 2F 27 03 F7 23 58 EE B9 6C
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>



-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
RE: Differences Perl / Embperl [ In reply to ]
Thanks for the quick answer Gerald - but that i have tried already - with
no success :-(

[+...+] Tags didn't work as well (bad) as output to OUT- Filedescriptor...

It looks, like the $chunk1 string isn't handed over to the
parser-subroutines at all.

On Mon, 10 Apr 2000, Gerald Richter wrote:

> > [.-
> > use PostboxParse;
> > $chunk1 = "<POSTBOX
> > ACTION=UPDATE>soap\@foo.bar<PASSWORD></PASSWORD><FWADDR>soup\@blo.
> > bli.blub.de</FWADDR></POSTBOX>";
> > my $p = PostboxParse->new(); # create a new object
> > $p->parse($chunk1); # parse the string
> > $xx = $p->eof; # signal end of document
> > @aaa = $p->readmsg(); # get back the error-messages
> > foreach (@aaa){ # ... and print them
> > print "...>>>$_\n";
>
> You must print to OUT i.e.
>
> print OUT "...>>>$_\n";
>
> or use a [+ +] block instead

--
* NAMES: Ulrike Schepp Gigabell AG
* PHONE: [+49] [0]69 - 17084-742 D-60325 Frankfurt
* ENCR.: Key 0x5E34C939 B0 B1 ED D0 51 D1 0C 3B 82 23 2C 61 10 38 57 95
* SIGN : Key 0x59AFB1C5 59 5D 53 37 2F 79 A0 2F 27 03 F7 23 58 EE B9 6C
RE: Differences Perl / Embperl [ In reply to ]
On Mon, 10 Apr 2000, Gerald Richter wrote:

[...]
> Have you set the optRawInput in EMBPERL_OPTIONS ? You should always do this
> if you write in an text editor, otherwise Embperl will strip out all your
> HTML Tags from the string (or you have to correctly escape them as
> &lt;POSTBOX&gt; etc.)

Thanks Gerald - i think that was the point - some polishing on the output
as well and it will work!

Some things are so trivial.... ;-)))

Ulrike

--
* NAMES: Ulrike Schepp Gigabell AG
* PHONE: [+49] [0]69 - 17084-742 D-60325 Frankfurt
* ENCR.: Key 0x5E34C939 B0 B1 ED D0 51 D1 0C 3B 82 23 2C 61 10 38 57 95
* SIGN : Key 0x59AFB1C5 59 5D 53 37 2F 79 A0 2F 27 03 F7 23 58 EE B9 6C