Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Perl/TK: how to set defaults for the whole script?

by AnomalousMonk (Abbot)
on Oct 24, 2012 at 21:04 UTC ( #1000717=note: print w/ replies, xml ) Need Help??


in reply to Perl/TK: how to set defaults for the whole script?

... keep it in a variable ...

Not being quite as adventurous as choroba or kcott, I will often use a constant for something like this. The other alternative is a Readonly hash, but  Readonly imposes execution overhead that may be undesirable. The functional approach of stefbv is also nice.

use constant SCALE_DEFAULTS => qw(-width 10 -length 200 -etc 42); my $s = $MW->Scale(SCALE_DEFAULTS, -override => 1, etc...);


Comment on Re: Perl/TK: how to set defaults for the whole script?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-29 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls