in reply to Re^2: Constant names come into conflict with Perl style?
in thread Constant names come into conflict with Perl style?
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)
#!/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);
cheers --stephandecent_shell% perl -MLWP::UserAgent -Mconstant=PKGc,LWP::UserAgent -e +'print +PKGc->new();'
|
|---|