I'm gonna agree with perrin (typical!) and disagree, partially, with dragonchild (WTF OMG).

For straight function code I've taken to doing things like-

use HTML::Entities (); ... HTML::Entities::encode_entities($whatever);

Because I can't stand reading code later that is hard to follow or potentially sends you to the wrong package with much confusion. With cutting+pasting and knowing your IDE, fully qualifying stuff is easy to type and much easier to follow later.

For OO, the name space is carried in the object so, no problems.

Also, I find using CGI.pm's OO interface goofy. The main non-aesthetic difference is that your code will run slower as OO. Otherwise, CGI::param() is no different from $cgi->param(). It's great to have CGI.pm's objects when you need to sling objects around (like in TT2 or something), but many, most I've written, CGIs are standalone in a way that makes imperative code easier to read and much easier to type.

use CGI; my $cgi= CGI->new(); print $cgi->header(); # etc...

In reply to Re: Questions about sharing code by Your Mother
in thread Questions about sharing code by bradcathey

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.