Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: backtick operator

by AndyZaft (Hermit)
on May 13, 2010 at 22:03 UTC ( [id://839910] : note . print w/replies, xml ) Need Help??

in reply to Re^2: backtick operator
in thread backtick operator

Hmm, but it doesn't die when opening the .passwd file? That's weird, time to debug that get_db_login sub line by line right after the open statement. If for some reason you don't get anything from the file then your while loop would never get executed. Btw, you can use $ENV{USER} instead of `whoami`, one less system call :) I assume it is not dying from
die "$0: Could not find password for $dbUser" unless(defined($dbPass)) +;
since the $dbPass will be defined as an empty string at that point, right?

Replies are listed 'Best First'.
Re^4: backtick operator
by Anonymous Monk on May 14, 2010 at 03:11 UTC

    Found the problem - I needed to increment $| to autoflush. I had a long running sql statement after the call to dbConnect that made it seem as if it was hanging.

    I added the following:



      FWIW, always set $| to the value you want, ie on $|=1; or $|=0; off, because $|++; $|++; turns it on, then turns it off.

        $|++ doesn't toggle the value of the variable; $|-- does. Just checked it on 5.8 and 5.10.

         David Serrano
         (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling errors. Thank you!).