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

Re: Code Review Time!

by thundergnat (Deacon)
on Mar 15, 2012 at 16:01 UTC ( #959806=note: print w/ replies, xml ) Need Help??


in reply to Code Review Time!

Umm. wow. You've got some problems here. Ok, to very narrowly answer your question; the error:

No -label at C:/strawberry/perl/site/lib/Tk/Widget.pm line 256.

is caused by your menu commands not having any -label parameter. -text (or in this case, text) is not a valid parameter name for a Tk menu command. Look up valid parameters in perldoc Tk::Menu under $menu->add(type, ?option, value, option, value, ...?)

Some other problems that jumped out after a brief perusal:

There's no menu method seperator, it is spelled separator. Weird since you have it spelled correctly in some places, not in others.

The array and value being pushed are reversed in several push operations. push @list, $id; not push $id, @list;

You are missing a sigil on $key in line 237: $conf->{$key} = $value; not $conf->{key} = $value;

Seriously, activate the warnings and strict pragmas and fix or at least investigate everything that they report. If you are a fairly new Perl programmer it is worth it. Yes, turning them on will make perl complain about things that are not necessarily "wrong", but it will reduce the effort you need to spend debugging by orders of magnitude.


Comment on Re: Code Review Time!
Select or Download Code
Re^2: Code Review Time!
by linuxkid (Sexton) on Mar 15, 2012 at 22:26 UTC

    I've been working with perl for about 3 years, and using warnings and strict breaks everything, and it's annoying when it's something that people who just know how to type and use a mouse will end up using have to get the stuff from it.

    --linuxkid


    imrunningoutofideas.co.cc

      I've been working with perl for about 3 years, and using warnings and strict breaks everything, and it's annoying when it's something that people who just know how to type and use a mouse will end up using have to get the stuff from it.

      Read this if you want to cut your development time in half!

        i'd be willing to use diagnostics during developmet

        --linuxkid


        imrunningoutofideas.co.cc

      Wow, I've not seen such a rant since BK coined "use strict is gay" way back in 2001 (which inspired Acme::USIG).

      Update: Though the original historic bulletin board response from "bk" to Dave Cross is currently available via the Wayback Machine link above, I also embed the original text (including typos) below because it is too important to Perl history to risk losing:

      Posted By: bk
      Date: Wednesday, 2 May 2001, at 2:29 p.m.

      In Response To: Re: Will this work? (Dave Cross)

      No,but its true-- strict really does suck. I hate it. Its gay. Dont tell me ehat to do. And nobody wants your to be back, either.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2014-07-30 17:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (237 votes), past polls