Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Strict, my and warnings

by demerphq (Chancellor)
on Oct 16, 2002 at 11:13 UTC ( [id://205673]=note: print w/replies, xml ) Need Help??


in reply to Strict, my and warnings
in thread Many strings make one variable?

Will -w work in place of use warnings;

Yes. But use warnings is more powerful and localized to the module it is used in. If/when you upgrade to 5.6 or later then try to get into the habit of using warnings and not -w.

As for the code, it looks ok to me. (In principle.) Although I might write

my $bita=pack("C,hex($bit));
instead. And
my($RH,$GH,$BH)=($color =~ /(..)(..)(..)/);
Also it would be a good idea to get into the habit of indenting properly. You can check out the tool "PerlTidy" hosted on source forge to do have it done automatically for you. perlstyle will have some hints for you with regard to programming style. For instance $RH is not the best var name. To me it implies a filehandle or something else with "mystic" overtones (due to its captialization). I would probably have just used $red instead...

Ultimately it looks like you are on the right path... Keep it up!

HTH

--- demerphq
my friends call me, usually because I'm late....

Replies are listed 'Best First'.
Re: Re: Strict, my and warnings
by true (Pilgrim) on Oct 16, 2002 at 12:21 UTC
    Funny(Horrid) thing to share regarding the lack of -w and strict...
    I've been running a dozen linked perl scripts for
    several websites for 2 years now.
    Very sloppy, but working code with
    global dynamic variables, lack of 'my',
    and a few 'locals' where they should not be.
    I turned -w on...
    my apache error log generated 14,267 warnings.
    This is the total number of warnings issued for
    1 single request to one cgi.

    The main cgi only had 5041 lines of code,
    93 subroutines,
    and 2 to 3 requires.

    jtrue

    P.S. running strict was an impossibility.
    Apache said "unsafe" at line four and sacked the cgi.
    Guess what i'll be doing for the next couple of days.

    (See i don't mind showing my butt cheeks).
    In two weeks i'll be stronger.

    thanks for your help demerphq
      running strict was an impossibility. Apache said "unsafe" at line four and sacked the cgi.

      Im sure that if you post the circumstances for this that one of the Apache aware monks will help you get scripts working under strict

      In two weeks i'll be stronger.

      It looks like you are well along on the path to enlightenment. It may be a touch painful (14267! yikes!) but by the end of it you'll probably say it was worth it. And hanging out here and listening to the monks and participating will ease the pain a lot im sure. Incidentally dont be afraid to post answers and your ideas, you might get shot down a few times but if you take it well then nobody will mind helping out a bit....

      :-)

      --- demerphq
      my friends call me, usually because I'm late....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://205673]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-19 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found