in reply to filehandle close causes hang

Can you tell us exactly what line your program is hanging on? Just add some warn statements:
close(OUT); warn "got past close OUT"; close(ERROR); warn "got past close ERROR"; ... $apex_db->disconnect; warn "got past apex_db disconnect"; ...

Replies are listed 'Best First'.
Re^2: filehandle close causes hang
by marymarvel1 (Initiate) on Jun 09, 2008 at 19:18 UTC
    The code should read thus, and I am running perl in sybase unix attaching to sql database: my($ddate,$paydate); $ddate = '20080609'; print STDOUT "DATE $ddate\n"; $pay_date = get_medate($ddate); print STDOUT "back in call $pay_date\n"; . . . exit(0); sub get_medate { use strict 'vars'; my($dte) = "select max(calendar_date) from business_days_table where substring(calendar_date,1,6) =substring('$ddte',1,6) and is_NYSE_open = 'Y' and is_bank_holiday='N'"; print STDOUT "$mesql\n"; my($gt_cursor)=$scb_db->prepare($mesql); $gt_cursor->execute; my($medate) = $gt_cursor->fetchrow ; print STDOUT "MEDATE IN SUB $medate\n"; return $medate; } I get the print from the subroutine, I get no print from the calling line or after.
      I found the problem. I am running in SYBASE, and all the cursors have to be globally declared. If I do that, there are no hangups.