As ww says, nicely done! A couple of minor points:
-
In sub DrawSegment{, the line:
elsif($segment = 6) { # Draw the 6 sided segment(6)
is almost certainly a mistake: it sets $segment to the value 6, which is “true”, so the following else block will never be reached. Replace = with ==.
-
A subroutine such as:
sub GetValue{
my $return = $wxGlobals{mValue};
}
would be better written as:
sub GetValue{
return $wxGlobals{mValue};
}
as the lexical variable $return serves no purpose here — it is being created and initialised only to be immediately thrown away. Likewise, this:
sub Decode { # Table lookup for character t
+o
my($char) = @_; # Segment translation
my $return;
if(defined($ctbl{$char})) {
$return = $ctbl{$char};
}
else {
$return = $ctbl{'='}; # Triple bar for undefined cha
+racter
}
}
works, but only (in a sense) by accident: the last expression evaluated will be an assignment to $return, so the value assigned will be returned by the sub. But with a small code change, this logic could easily break. Simpler, safer, and clearer:
sub Decode # Table lookup for character t
+o segment translation
{
my ($char) = @_;
if (defined $ctbl{$char})
{
return $ctbl{$char};
}
return $ctbl{'='}; # Triple bar for undefined cha
+racter
}
Update: ++BrowserUk for the much better version below!
Hope that helps,
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|