Thanks for pointing this out. I actually remember the discussion on p5p and it was interesting, see the CLONE_SKIP story.
So the underscore is not so good actually :(. The next best thing
could be a simple "postfix".
use constant MYPACKAGE_c => 'Universe::Tiny';
use constant RWXu => 0700;
use constant MYLOGGERc => \do{local *FH; *FH};
Actually a postfix like "c" or "_c" (or even "const" if you don't feel lazy) is good *visually* to remember they are gotchas like remembering when {}ing is actually necessary! (stressed by PBP)
MYPACKAGE_c->factory();
print {LOGGERc} "important login data";
#!/usr/bin/perl
use strict;
use warnings;
use constant LOGGERc => \do{local *FH; *FH}; # silence warnings
open LOGGERc, ">mylog" or die; # gotcha
print {LOGGERc} "info...", "\n" or die;
print {\*STDOUT} qx(cat mylog);
decent_shell% perl -MLWP::UserAgent -Mconstant=PKGc,LWP::UserAgent -e
+'print +PKGc->new();'
cheers
--stephan
-
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.
|