in reply to Or die killing my script

Does anyone have any idea why or die would be affecting my script even if it isn't called?
"or die" cannot affect your script if its not being executed.

Why do you have

open( STDERR, ">>/home/sulfericacid/public_html/test/error.log" ) or die "Cannot open error log, weird...an error opening an error log +: $!";
at the top? Also, why do you sprinkle use lines sporadically around your program? (group them together so they're easy to find).

I see you have written

open( SAVED, ">>$localfile" ); # || die $!;
That is never good. If you're going to do stuff like that, do it like
if( open SAVED, ">>$localfile" ) { print SAVED $crack; }
Also, why don't you use CGI::Carp; like it's been suggested often to you.

update: I also forgot to ask you (like I did in the CB a few days ago) why do you use warnings and the -w switch? The only reason I could think of is if you don't know the difference, in which case, you should learn the difference.

And oh yea, why aren't you use-ing strict? I can't see why people would continue to help you after you continually ignore the same vital advice time and time again (madness).

update: another question, why print "<br>" if you use CGI ':standard';?


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: Or die killing my script
by Juerd (Abbot) on Apr 20, 2003 at 14:07 UTC

    why print "<br>" if you use CGI ':standard';?

    Maybe because CGI.pm doesn't have a br method. Or perhaps because the examples in CGI.pm's documentation print "<br>" too.

    Or maybe just because it works, or because it would be more efficient than the method - if it existed.

    Juerd
    - http://juerd.nl/
    - spamcollector_perlmonks@juerd.nl (do not use).
    

      First off,
      CGI.pm defines general HTML shortcut methods for most, if not all of the HTML 3 and HTML 4 tags. HTML shortcuts are named after a single HTML element and return a fragment of HTML text that you can then print or manipulate as you like. Each shortcut returns a fragment of HTML code that you can append to a string, save to a file, or, most commonly, print out so that it displays in the browser window.
      ...
      :standard
      Import ``standard'' features, 'html2', 'html3', 'html4', 'form' and 'cgi'.
      Secondly,
      >perl -MCGI=:standard -e die+br <br /> at -e line 1. >
      Or maybe just because it works, or because it would be more efficient than the method ...
      In that case why does he bother to import it? Why does he bother with any of the html shortcuts, like hr (heredocs anyone)? I say, if you're going to go, go all out, or don't bother.


      MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
      I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
      ** The Third rule of perl club is a statement of fact: pod is sexy.

        Hi Podmaster,
        I'm starting out with my first 'proper' use of CGI.pm today (rather than 'winging it' like I have done in the past. This means I'm sitting down with Dr Stein's book and being disciplined about what I use in the script. Sometimes in the heat of trying to get the script finished, that can be difficult:)

        Well, I was browsing the book and in the middle of Listing 3.1 which can be found here around line 70 are the following lines:

        print <<END; <hr> <a href="../../source.html">Code examples</a></address> END

        Now he does use hr, elsewhere in the script, but having recently read your comments in this post I thought I'd point it out to you, and enquire if this is an inconsistency in the script, or if there's a reason for it.

        Also, if you have a moment, when functions are written hr() or br(), of what use are the parentheses in this case (perhaps colour could be assigned to horizontal rule?). I'd be interested if you could let me know.

        Thanks