develooper Front page | perl.perl5.porters | Postings from June 2012

Re: [PATCH] Add "use strict" to lib/perl5db.pl

Thread Previous | Thread Next
From:
Shlomi Fish
Date:
June 14, 2012 01:16
Subject:
Re: [PATCH] Add "use strict" to lib/perl5db.pl
Message ID:
20120614111640.5dc60393@lap.shlomifish.org
Hi Richard,

On Mon, 11 Jun 2012 13:17:21 +0200
Richard Foley <richard.foley@rfi.net> wrote:

> A solution which would permit the patch (or one similar) might be to make the
> "use strict" behaviour dependent on an option setting, something like:
> 
>     PERLDB_OPTS="useStrict=1" perl -d ...
> 
> Just an idea.
> 

This will be very hard to do properly because "use strict;" is lexically
scoped. For example, this code runs fine:

[CODE]
#!/usr/bin/perl

sub called_sub
{
    $x = 500;
    print "X = $x\n";
}

sub caller_sub
{
    use strict;
    called_sub();
}

caller_sub();
[/CODE]

Furthermore, since the patch makes the code conform to the "use strict;"
conventions, why not enable it and gain the advantages of strict.pm? Otherwise
we will have strict-compliant code without "use strict;".

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/

<rindolf>  If you repeat a scene 50k times, then the movie will have less 
entropy and will compress better. ( irc://irc.freenode.org/#perlcafe )

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About