Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: (tye)Re: A Little review for a little DBI and CGI?

by coolmichael (Deacon)
on Mar 28, 2001 at 13:46 UTC ( [id://67788]=note: print w/replies, xml ) Need Help??


in reply to (tye)Re: A Little review for a little DBI and CGI?
in thread A Little review for a little DBI and CGI?

It isn't that I doubt you, but I've been getting die error messages from the script while testing it. I tried a few things on the command line

C:\WINDOWS\Desktop>perl -e "2==1 or die qw(dying)" dying at -e line 1. C:\WINDOWS\Desktop>perl -e "2==1 || die qw(dying)" dying at -e line 1. C:\WINDOWS\Desktop>
I'm using ActiveState Perl v5.6.0 on win98 (above) and 5.005_03 linux below
[michael@subtext michael]$ perl -e "2==1 or die qw(dying);" dying at -e line 1. [michael@subtext michael]$ perl -e "2==1 || die qw(dying);" dying at -e line 1.
My copy of the camel is at work (second perl book I bought, the first one was the llama). I'll see what it says about || and or tomorrow.

update:You're completly right Tye. I didn't know the brackets would change things. I've made the change as you suggested.

Also, thank you for your comments. In the reply, I forgot to thank you. That'll teach me to post at 1:00 am.

Edit: chipmunk 2001-03-30

Replies are listed 'Best First'.
(tye)Re2: A Little review for a little DBI and CGI?
by tye (Sage) on Mar 28, 2001 at 20:38 UTC

    open HTML, "startpage" || die "opening startpage: $!\n";

    is parsed as: open HTML, ( "startpage" || die "opening startpage: $!\n" ) but the expression "startpage" is always true so the die will never be executed. To test, just change "startpage" to "smartmage" or some other non-existant file name.

    The problem is a matter of precedence.

    An alternate solution is: open( HTML, "startpage" ) || die "opening startpage: $!\n"; but I'd still use or for that for the sake of robustness (in case someone comes along and remove the parens).

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-23 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found