List Info

Thread: Requiring strictness everywhere




Requiring strictness everywhere
user name
2006-08-09 21:36:14
Yes, I know I am generating most of this month's threads,
but
migrating to a new way of working always raises questions
 I
looked
this up as well, but could only find a 2002 conversation [1]
that left
me exactly where I was at the beginning.

I am a fan of writing Perl under the influence of the
'strict'
pragma. It is a great butt-saver. In fact, yesterday I
committed a
bunch of changes [2] introducing a [$ var $dummy $] line to
each of my
pages. 

Anyway... If this is just to be filed as a wishlist request,
so be it
- But we humans tend to forget stuff. I'm sure I will
create one or
three webpages, and then forget to set the [$ var $dummy $]
line on
them. No great deal, but it breaks what I expect from the
compiler. It
would be great if I could just tell Embperl to enforce
strictness on
all of its files, at least on all which are not with
Syntax=>'Perl'.

If there is a way, please point me to it 

Greetings,

[1] http://www2.ecos.de/~mailarc/embperl/2002-11/msg00002.
html

[2] http://svn.debian.org/wsvn/comas/trunk/embperl/?
rev=790&sc=1

-- 
Gunnar Wolf - gwolfgwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5
27AF

------------------------------------------------------------
---------
To unsubscribe, e-mail: embperl-unsubscribeperl.apache.org
For additional commands, e-mail: embperl-helpperl.apache.org

Requiring strictness everywhere
user name
2006-08-10 04:41:58
> 
> If there is a way, please point me to it 
> 

You can use Embperl_Top_Include in your httpd.conf to add a
"use strict" to
every page

Gerald



 
** Virus checked by BB-5000 Mailfilter ** 


------------------------------------------------------------
---------
To unsubscribe, e-mail: embperl-unsubscribeperl.apache.org
For additional commands, e-mail: embperl-helpperl.apache.org

Requiring strictness everywhere
user name
2006-08-11 14:52:18
Gerald Richter dijo [Thu, Aug 10, 2006 at 06:41:58AM +0200]:
> > 
> > If there is a way, please point me to it 
> > 
> 
> You can use Embperl_Top_Include in your httpd.conf to
add a "use strict" to
> every page

Hmh... Does not appear to work - Having that variable set in
my
configuration, the pages still display even if having
undeclared
variables. Besides, trying to specify it from within
base.pm, I did:

    $epreq->config->top_include = 'use strict;';

and got:

[Fri Aug 11 16:22:25 2006] [error] [9242]ERR:  24:  Error in
Perl code: Can't locate object method
"top_include" via package
"Embperl::Req::Config" at
/home/gwolf/cvs/comas/trunk/embperl/base.pm line 49.

This is using Embperl 2.0rc3-1 (the version shipped in
Debian
Sarge). The code does get executed, but I guess this happens
inside an
eval block, so it does have any real effect - I tried also
setting
EMBPERL_TOP_INCLUDE to "warn 'Alive';", and
-as expected- got:

[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 69) line 2.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 74) line 2.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 100) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 105) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 109) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 113) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 117) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 121) line 2, <GEN0> line
4.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 126) line 2.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 130) line 2.
[Fri Aug 11 16:34:01 2006] [warn] [9723]ERR:  32:  Warning
in Perl code: Alive at (eval 134) line 2.

This means, once for each file evaluated.

Greetings,

-- 
Gunnar Wolf - gwolfgwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5
27AF

------------------------------------------------------------
---------
To unsubscribe, e-mail: embperl-unsubscribeperl.apache.org
For additional commands, e-mail: embperl-helpperl.apache.org

Requiring strictness everywhere
user name
2006-08-16 06:06:49
Hi,

> > 
> > You can use Embperl_Top_Include in your httpd.conf
to add a "use 
> > strict" to every page
> 
> Hmh... Does not appear to work - Having that variable
set in 
> my configuration, the pages still display even if
having 
> undeclared variables. 

Ok, you are right it works for other "use"es,
but not for use strict,
because of scoping issues.

The only other chance is to modify Embperl/Syntax.pm, search
for "# any
initialisation could be put here" and add your use
strict.

> Besides, trying to specify it from 
> within base.pm, I did:
> 
>     $epreq->config->top_include = 'use
strict;';
> 
> and got:
> 
> [Fri Aug 11 16:22:25 2006] [error] [9242]ERR:  24: 
Error in 
> Perl code: Can't locate object method
"top_include" via 
> package "Embperl::Req::Config" at 
> /home/gwolf/cvs/comas/trunk/embperl/base.pm line 49.

Yes, of course this must be done before Embperl starts to
compile the page
and inside the base template this is already done.

Gerald




 
** Virus checked by BB-5000 Mailfilter ** 


------------------------------------------------------------
---------
To unsubscribe, e-mail: embperl-unsubscribeperl.apache.org
For additional commands, e-mail: embperl-helpperl.apache.org

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )