I don't think 1200 lines of code is that much --- I have a Perl/Tk application with 17000 lines and a gazillion of global variables, but I'm still comfortable with it.
You don't necessarily have to switch to OO programming. Maybe you can first organize your code better, but still use the procedural style? As for the global variables: the only global variable representing a widget you really need is $mw. All other widgets may be expressed as subwidgets. See the Tk::mega manual about Subwidget and Advertise. If you have non-GUI data, then you may consider to move just these parts into modules. Consider to create megawidgets if possible (the Tk::mega manual also helps here). Limit the scopes of variables as much as possible by using functions or just blocks, e.g.:
# ... code before
{
my $f = $top->Frame->pack; # frame needed only for layouting pur
+poses
$f->Label(...)->pack(...);
$f->Label(...)->pack(...);
...
}
# ... not interested in $f anymore ...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.