Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: A Matter of Style

by tobyink (Abbot)
on Oct 22, 2012 at 20:27 UTC ( #1000414=note: print w/ replies, xml ) Need Help??


in reply to A Matter of Style

If you brace your packages, a la:

{ package Foo::Bar; use strict; ...; } package Foo::Bar; { use strict; ...; } # Perl 5.14+ package Foo::Bar { use strict; ...; }

... then it makes a difference, because lexically scoped pragma such as strict will end with the closing brace.

If you put multiple packages in the same file, then there are good arguments in favour of bracing each package - to prevent, e.g. leakage of our variables.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: A Matter of Style
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-10-20 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (74 votes), past polls