You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Michael Stevens <mi...@iii.co.uk> on 2002/05/02 17:42:55 UTC
Embperl 2.0b4_dev-5 problems defining new syntaxes
Hi.
I'm trying to write a syntax module that rewrites certain tags
in HTML, but I'm getting lots of errors when I try to rewrite
an attribute that's set by [+ $foo +]. An example is:
--cut here--
[$ syntax +III::MinimalTag $]
[- $attribute = "moo"; -]
<test attribute="[+ $attribute +]"></test>
--cut here--
The III::MinimalTag module is:
--cut here--
package III::MinimalTag;
use HTML::Embperl::Syntax qw{:types} ;
use HTML::Embperl::Syntax::HTML ;
# We inherit the generic HTML support from HTML::Embperl::Syntax::HTML
use vars qw(@ISA);
@ISA = qw(HTML::Embperl::Syntax::HTML) ;
sub new {
my $class = shift;
my $self = HTML::Embperl::Syntax::HTML::new($class);
# initialise ourselves when an object is created if it hasn't
# been done already
if (!$self->{-randomInit}) {
$self->{-randomInit} = 1;
init($self);
}
return $self;
}
# initialise things and define our new syntax handling
sub init {
my $self = shift;
# redefine the tags we want to manipulate attributes for
$self->AddTag('test', ['attribute'], undef, undef, {
perlcode => q[ {
# _ep_sa is an apparently undocumented function which
# allows you to rewrite an attribute of the current node
# specified by %$n%
_ep_sa(%$n%, 'attribute', %&'attribute%);
}],
});
}
1;
--cut here--
I'm using Embperl 2.0b4_dev-5 on a linux machine with perl 5.6.1
When I request this with a web browser, I get random results
including:
* Segmentation Faults in apache
* <test attribute=""></test>
* Sometimes a response that seems to be an endless loop of
moomoomoomoomoomoomoomoo....
Michael
Interactive Investor Trading Limited trading as
"Ample" is an independent intermediary regulated by
the Financial Services Authority. Registered in
England with registered office at 142 Holborn, London
EC1N 2NQ and Company Registration Number 3699618. A
member of the AMP Group. We may record and/or monitor
telephone calls or intercept other telecommunications
between us. This is to protect both of us and for
training purposes.
The information in this email is confidential and may
be legally privileged. It is intended solely for the
addressee and access to this email by anyone else is
unauthorised. If this email has come to you in error
you must not read or forward the email to anyone,
please reply to this email and highlight the error.
Although this message and any attachments are believed
to be free of any virus or other defect that might
affect any computer system into which it is received
and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility
is accepted by Interactive Investor Trading Limited
for any loss or damage in any way arising from its
use.
Re: Embperl 2.0b4_dev-5 problems defining new syntaxes
Posted by Gerald Richter <ri...@ecos.de>.
Hi.
> # redefine the tags we want to manipulate attributes for
> $self->AddTag('test', ['attribute'], undef, undef, {
> perlcode => q[ {
> # _ep_sa is an apparently undocumented function which
> # allows you to rewrite an attribute of the current node
> # specified by %$n%
> _ep_sa(%$n%, 'attribute', %&'attribute%);
> }],
>
Please move the comment out of the perlcode section, because line breaks may
change in the final code.Also the braces inside the q[ ] aren't necessary,
also they shouldn't create trouble:
$self->AddTag('test', ['attribute'], undef, undef, {
# _ep_sa is an apparently undocumented function which
# allows you to rewrite an attribute of the current node
# specified by %$n%
perlcode => q[ _ep_sa(%$n%, 'attribute', %&'attribute%); ],
});
If this still doesn't work, please set EMBPERL_DEBUG to 0x7ffffffe and send
me the resulting embperl.log file when you do the request
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 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org