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.

sub sql_select_from_musings{ return qq| SELECT musing_id, ref_id, heading, entry, DATE_FORMAT(entry_date, '%M %e, %Y') FROM musings |; }
Then for one of your SQL statements, you could type
$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:

my $apples = 5; my $watermelons = 7;
becomes
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_script

instead of having to use two levels of dereferencing.

Just my ideas; use whatever suits you.


In reply to Re: How's My Style Now? by molecules
in thread How's My Style Now? by Spenser

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.