Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Perl TK Submit enter incorrect routine

by thundergnat (Deacon)
on Nov 15, 2005 at 12:16 UTC ( [id://508574]=note: print w/replies, xml ) Need Help??


in reply to Perl TK Submit enter incorrect routine

What a mess! You REALLY need to use warnings; and use strict; and fix all of the problems they report. You have an incredible amount of duplicate and redundant code in there too. (I suspect this is from some kind of code generator) There are too many errors to go into all of them; lots of undeclared variables, use of prototypes where they are clearly NOT useful or desireable, too much copy & paste coding, etc.

To answer your main question: Seems to me that the correct routine is being called. If the only thing telling you it ISN'T is the line

INFO: The following admins password (Tester) was reset

then the fifth line of process_amend_userorderroute is suspect.

$txt->insert('end', "INFO: The following admins password ($guid) was r +eset\n");

Replies are listed 'Best First'.
Re^2: Perl TK Submit enter incorrect routine
by minixman (Beadle) on Nov 15, 2005 at 12:22 UTC
    I am using strict in the program.
    in the routines TK i have our which i though't kept the variables non-global and in that routine only.

      I took a longer look at it and have some more detailed comments/advice.

      In General:

      Use more white space. It's inexpensive and makes debugging less tedious. (Personal opinion, though many will agree.)

      Somewhat related, indent consistantly. Inconsistent, semi-random indentation makes finding missing/extra brackets an excercise in frustration. It also makes following the logic of nested if blocks very tedious.

      Don't declare variables as globals unless necessary, 'our' variables have especially far-reaching scopes and should be avoided if possible. Use 'my' variables instead.

      Keep variables in the smallest scope practical, don't pass Tk widget names to subroutiness if all you want is the widgets' value, pass the value instead. Action-at-a-distance bugs are hard to track down.

      If you are just going to use default values for object attributes, don't include them, it clutters up the code unnecessarily and makes it more difficult for others to help you debug.

      Don't use prototypes for subroutines if you don't need them. And even if you think you do, you probably don't.

      Don't call subroutines with the leading ampersand unless you need the effects it adds. If you don't know what effects it adds, you probably don't need it.

      Something I found puzzling, in the sub process_amend_userorderroute, there are many situations where you are writing information out to a text widget, then, before the information could possibly be displayed, destroying the toplevel that the widget is in. Seems like a lot of wasted effort.

      Anyway, I took the liberty of rewriting some of your code to demonstrate what I am talking about. There are lots of missing subs, so it won't work standalone. It is still more cluttered than I would prefer, but it is a step in the right direction. Take it or leave it as you like.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-24 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found