Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl

Requiring strictness everywhere

 

 

ModPerl embperl RSS feed   Index | Next | Previous | View Threaded


gwolf at gwolf

Aug 9, 2006, 2:36 PM

Post #1 of 4 (1566 views)
Permalink
Requiring strictness everywhere

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 - gwolf [at] gwolf - (+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-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl


richter at ecos

Aug 9, 2006, 9:41 PM

Post #2 of 4 (1437 views)
Permalink
RE: Requiring strictness everywhere [In reply to]

>
> 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-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl


gwolf at gwolf

Aug 11, 2006, 7:52 AM

Post #3 of 4 (1434 views)
Permalink
Re: Requiring strictness everywhere [In reply to]

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 - gwolf [at] gwolf - (+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-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl


richter at ecos

Aug 15, 2006, 11:06 PM

Post #4 of 4 (1414 views)
Permalink
RE: Requiring strictness everywhere [In reply to]

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-unsubscribe [at] perl
For additional commands, e-mail: embperl-help [at] perl

ModPerl embperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.