Hello Monks. I'm trying to connect to a mainframe with DBI. I understand almost nothing about mainframes. Most of the time the code below works fine. However, once in a while the code can not connect to the mainframe and just spins the cpu (i can see this with the top command on the linux box) and doesn't time out. When this happens I'd like the code to timeout and exit. The weird thing is I tested the following code on a "dummy" infinite loop and it worked in that case. Any ideas on how i can get this to work? Thank you for your help,
Erik
eval{
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
alarm($timeout);
$conn = DBI->connect($connection, $USER, $PASS,
{ RaiseError => 0, AutoCommit => 1 }
);
alarm(0);
};
if ($@){
my_die ( "Unable to login : [$@]: [$conn->errstr]");
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.