perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Gunton <neil.embp...@home.nilspace.com>
Subject Re: Global 'use strict' in 2.x
Date Wed, 06 Nov 2002 12:15:51 GMT
Specific example...

base.epl:

[$ var $global $]
[- 
   $global = shift;
   $global->{core} = Execute ({object => 'Core.epl'});
   Execute ('*');
-]

Core.epl:

[$ sub hello $]
   [* use strict; my ($self, $name) = @_; *]
   Hello [+ $name +]!!!!
   <P>
[$ endsub $]

[$ sub goodbye $]
   [* my ($self, $name) = @_; *]
   [* $xxx = 123; *]
   Goodbye, [+ $name +] [+ $xxx +]
   <P>
[$ endsub $]

This results in output:

Hello Neil!!!! 

Goodbye, Neil 123 


Neil Gunton <neil.embperl@home.nilspace.com> wrote:
> Gerald Richter <richter@ecos.de> wrote:
> > > Hi Gerald, I'm trying to enforce 'use strict' in my [$ sub $] routines for
> > > 2.0b8. Is there any way to tell Embperl to use strict in every [$ sub $]
> > without
> > > having to do something like the following?
> > >
> > > [$ sub hello $]
> > >    [* use strict; my ($self, $name) = @_; *]
> > >    Hello [+ $name +]!!!!
> > > [$ endsub $]
> > >
> > > I'd like to avoid having to put the 'use strict' explicitly in every [$
> > sub $].
> > 
> > I think it should be enough to put it in the first sub, but then it is only
> > active inside of subs.
> 
> This does not seem to work at present. Specifically the case I have is
> 'Core.epl', which is Executed as an object from base.epl (using
> Embperl::Object). If I have two [$ sub $] in this file, and use strict in the
> first one, and not in the second, then the second one allows the use of
> arbitrary variables without complaint. If I use strict explicitly in every [$
> sub $], then it's enforced.
> 
> > Using [$var$] without any variables, should force strict in all parts of the
> > page
> 
> In my Core.epl, this results in an error:
> 
> [1383]ERR: 24: Error in Perl code: 'undef' is not a valid variable name at
> /www/vhosts/test.nilspace.com/htdocs/Core.epl line 1 
>     BEGIN failed--compilation aborted (in cleanup) 'undef' is not a valid
> variable name at
> /www/vhosts/test.nilspace.com/htdocs/Core.epl line 1 
>     BEGIN failed--compilation aborted at
> /www/vhosts/test.nilspace.com/htdocs/Core.epl line 1.
> 
> Thanks, as always, for your help!
> 
> All the best,
> 
> -Neil
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message