Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found