Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: TK Submenus (Tk::Menu , global variables/ spirit of strict)

by Anonymous Monk
on Oct 29, 2013 at 00:53 UTC ( [id://1060092]=note: print w/replies, xml ) Need Help??


in reply to TK Submenus

Some food for thought :)

Why don't you use Tk::Menu? There is example at widget - Demonstration of Perl/Tk widgets, Menus : 1. Menus and cascades (sub-menus)

Why don't your functions/subroutines take arguments? Why do they work on "global" variables?

Slapping "my $globalvariable" on $globalvariable is not in the spirit of strict, but passing( $variables, $around, is( $in, $thespirit, $of, $strict ) );

 strict itself confers no benefits; The benefits come from avoidance of the bad practices forbidden by  strict :)

Write function, functions that take arguments, functions that return values, functions that don't operate on global variables , but functions that pass variables around
Examples Re: Tk: Creating label in hash

Start reading at Re^2: Border-less main window (Alt+F4 Ctrl+C and follow through to examples Re: Perk Tk - how to send a value from a subroutine back to the main program using Button (without MainLoop), Re: Perl tk FindNext in a text widget, Confused by variable scope in Tk::Wizard

If you're not convinced by what I'm saying read these links

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-29 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found