Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: RFC: spam reporting assistant

by Jaap (Curate)
on Dec 18, 2007 at 15:42 UTC ( #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:
    global variables
    Bare block to load __DATA__

    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?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2021-09-20 09:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found