I was looking through the source code for Data::Maker and noticed the author put a lot of spaces around his expressions.
sub rand_date { # Get the options hash my %options = @_; # use the Date::Calc module eval q{ use Date::Calc }; cluck($@) && return if $@; my ( $min_year, $min_month, $min_day, $max_year, $max_month, $max_ +day ); # Get today's date my ( $year, $month, $day ) = Date::Calc::Today(); if ( $options{'min'} ) { if ( $options{'min'} eq 'now' ) { ( $min_year, $min_month, $min_day ) = ( $year, $month, $da +y ); } else { ( $min_year, $min_month, $min_day ) = split ( /\-/, $options{'min'} ); } } else { ( $min_year, $min_month, $min_day ) = ( $year, $month, $day ); } if ( $options{'max'} ) { if ( $options{'max'} eq 'now' ) { ( $max_year, $max_month, $max_day ) = ( $year, $month, $da +y ); } else { ( $max_year, $max_month, $max_day ) = split ( /\-/, $options{'max'} ); } } else { ( $max_year, $max_month, $max_day ) = Date::Calc::Add_Delta_YMD( $min_year, $min_month, $min_day, +1, 0, 0 ); } my $delta_days = Date::Calc::Delta_Days( $min_year, $min_month, $min_day, $max_ye +ar, $max_month, $max_day, ); cluck('max date is later than min date') && return if $delta_days +< 0; $delta_days = int( rand( $delta_days + 1 ) ); ( $year, $month, $day ) = Date::Calc::Add_Delta_Days( $min_year, $min_month, $min_day, $delta_days ); return sprintf( "%04u-%02u-%02u", $year, $month, $day ); }
I found it very clean and easy to read. I'm an Emacs user and would like to switch to that mode of formatting my text. But I'm not sure if that's possible.



The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"


In reply to Code Formatting - generous spaces in expressions by metaperl

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.