in reply to -w, strict, and Tk...

I don't feel that strict can be stressed too much, but I do often see production code have the -w removed. Running with warnings enabled is good and helpful for development and testing, but the warnings are rarely helpful to the end-user, unless your user-base is also Perl-savvy.

As for the "used only once" cases, that's hard to address without some code in front of me. I've written several applications with Tk, and in all the cases I can remember I had to use an object value more than once, even if all I did was use it to call pack after creation. If you are crafting your constructor calls such that it threads through from new --> pack in one (long, complex) statement, then maybe you don't need to be assigning the value to a variable? Why not just:

<code> my $MW = Tk::MainWindow->new();

$MW->button(-text => 'Quit', -command => sub { exit })->pack; <code>

--rjray

Replies are listed 'Best First'.
Re: Re: -w, strict, and Tk...
by Necos (Friar) on Mar 20, 2002 at 03:40 UTC
    As per request, I've put the code up on my scratchpad. Basically, the only reason I need to keep a few of the named variables is so I can pull values from them (for example, I pull data from the Entry, and Listbox widgets). There might be a flaw in my design. If so, please point it out. I'm always looking for more tricks to better my Perl skills (and general programming skills for that matter).

    Theodore Charles III
    Network Administrator
    Los Angeles Senior High
    4650 W. Olympic Blvd.
    Los Angeles, CA 90019
    323-937-3210 ext. 224
    email->secon_kun@hotmail.com