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 <[EMAIL PROTECTED]> wrote:
> Gerald Richter <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]