Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: RFC: spam reporting assistant

by Jaap (Curate)
on Dec 18, 2007 at 15:42 UTC ( [id://657693]=note: print w/replies, xml ) Need Help??


in reply to RFC: spam reporting assistant

Wow that is quite long. One comment: In stead of this:
my @sLart; #Assembly for the elements of the email my @aoaCheck; #Array of checkbox data #[][0] is the checkbox itself #[][1] is the 'ticked' variable #[][2] is the text my $nLandings = 0; #Number of landing points analysed my $sServer; #Whois server my %hoaBank; #Hash of Arrays of banks my $sBank; #Selected bank from combobox my $sTo; #Email address of $sBank my $sFrom; #Spamgourmet prefix for $sBank
it is usually better to declare your variables where you use them first (that way, and with strict, you get a nice warning when you double-use a variable name).

Replies are listed 'Best First'.
Re^2: RFC: spam reporting assistant
by davies (Prior) on Dec 18, 2007 at 16:45 UTC
    The length is mostly down to documentation, as I'm sure you realise. Without the POD statements, it's more like 250 lines, and can be reduced still further by putting all assignments (especially in the Tk statements) on a single line. Isn't that always the way with documentation?

    As far as the global variables are concerned, about half of them are bound to Tk widgets. I wanted to keep like with like, and declare them before I started declaring the widgets. On the same basis, I wanted all the global variables declared together. "All the rotten eggs in one basket". The code is laid out thuswise:
    use
    global variables
    Tk
    Bare block to load __DATA__
    MainLoop
    Subroutines

    If this is bad style, I'd like to change it. But doing it this way fits my brain, so if there are reasons, I'd love to know them, whether by direct explanation or by reference. I can see that declaring a variable before it's needed can mean that it gets used accidentally. But given that there are only 8 of them, I felt that having them in a single block would mean that there was a reduced chance of double use, and an increased chance of seeing what each declaration was intended to achieve.

    Thanks and regards,

    John Davies

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found