in reply to How's My Style Now?
I like code reviews. Good idea.
(1) Since you have three SQL statements starting with identical text, I would create a subroutine for that part.
Then for one of your SQL statements, you could typesub sql_select_from_musings{ return qq| SELECT musing_id, ref_id, heading, entry, DATE_FORMAT(entry_date, '%M %e, %Y') FROM musings |; }
$sql_statement = sql_select_from_musings() . qq|ORDER BY entry_date DESC|;
(2) I like using PerlTidy. I use the Perl Best Practices .perltidyrc with it.
This will help you apply ap1's suggestion above automatically. For example:
becomesmy $apples = 5; my $watermelons = 7;
my $apples = 5; my $watermelons = 7;
without my having to type extra spaces. If I changed $watermelons to $pears, then Perl Tidy can respace it without me having to add or delete spaces manually.
Several IDEs/editors have ways you can set it up to run Perl Tidy with a single command.
(3) I also like Data::Alias. For example, you could have this line:
alias my $musing_script = $scripts->{'musing'}->{'script'};After which, you can just type
$musing_scriptinstead of having to use two levels of dereferencing.
Just my ideas; use whatever suits you.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How's My Style Now?
by Spenser (Friar) on Feb 08, 2010 at 14:57 UTC | |
by TGI (Parson) on Feb 08, 2010 at 19:22 UTC |