Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Backdating strict

by Bod (Parson)
on Nov 19, 2020 at 17:14 UTC ( [id://11123832]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Backdating strict
in thread Backdating strict

That does sound like the best way forward for me...enforce strict initially one subroutine at a time then one lexical block at a time until the complete code unit has strictures enforced.

Quick question...
If I have use strict; followed by a require statement in the same block, does the code that is brought in by the require have strict applied to it - my guess is yes as it is in the same lexical block.

I can't test it right now as I am using my mobile and AFAIK there isn't a version of Perl for Android.

Replies are listed 'Best First'.
Re^4: Backdating strict
by jcb (Parson) on Nov 20, 2020 at 02:49 UTC

    No, code brought in with use or require is its own top-level lexical scope.

    Explained differently, lexical scopes do not cross file boundaries in Perl; the loading mechanism is not a preprocessor.

    If this were not so, the common convention of making use strict; the first statement in a script would also apply strict to all library modules, but this does not happen.

Re^4: Backdating strict
by marto (Cardinal) on Nov 19, 2020 at 17:55 UTC

    I've not used this in a while, perhaps worth checking out.

      Thanks marto - that looks rather interesting!

      I was right...it is very interesting and now I have a newer version of Perl - 5.32 on my mobile than I do on my laptop or webserver!!! Somehow that doesn't seem quite right but some things are best left unquestioned :)

      Thanks for the information marto

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-20 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found