D
Derrell Durrett
Howdy-
I have a situation in which a program that executes on solaris, a RedHat
flavor of Linux (32- and 64-bit), and Windows XP (32- and 64-bit) fails
on 32-bit XP w/the $! value equivalent to the string "Too many open files."
I am running an external program whose output to stderr I want to
capture, in case it's interesting. The algorithm is (as suggested in
recipe 7.20 in the Perl Cookbook):
dup STDERR (open using ">&" ) to new filehandle.
create new filehandle, to temporary file (using IO::File->new_tmpfile)
take file-descriptor of new filehandle (using fileno())
alias STDERR to new filehandle (open STDERR using ">&=$fileno" )
I then run my external program, and close the filehandles, undef the
temporary variable attached to the temporary file, and reopen stderr to
point back to the original.
In opening STDERR to alias it to the temporary file's descriptor, the
program fails.
I've done this in the debugger, and when I look at the symbol table for
either main, or the package in which the filehandles are being created,
and I don't see anything unusual (only STDOUT, STDIN, STDERR, and the
duplicate ). I did this using the 'x \%main::' and
'x\%<package_name>::' commands at the debugger command line.
Is there a better way to see what files are open? Is this likely a red
herring?
Thanks,
Derrell
I have a situation in which a program that executes on solaris, a RedHat
flavor of Linux (32- and 64-bit), and Windows XP (32- and 64-bit) fails
on 32-bit XP w/the $! value equivalent to the string "Too many open files."
I am running an external program whose output to stderr I want to
capture, in case it's interesting. The algorithm is (as suggested in
recipe 7.20 in the Perl Cookbook):
dup STDERR (open using ">&" ) to new filehandle.
create new filehandle, to temporary file (using IO::File->new_tmpfile)
take file-descriptor of new filehandle (using fileno())
alias STDERR to new filehandle (open STDERR using ">&=$fileno" )
I then run my external program, and close the filehandles, undef the
temporary variable attached to the temporary file, and reopen stderr to
point back to the original.
In opening STDERR to alias it to the temporary file's descriptor, the
program fails.
I've done this in the debugger, and when I look at the symbol table for
either main, or the package in which the filehandles are being created,
and I don't see anything unusual (only STDOUT, STDIN, STDERR, and the
duplicate ). I did this using the 'x \%main::' and
'x\%<package_name>::' commands at the debugger command line.
Is there a better way to see what files are open? Is this likely a red
herring?
Thanks,
Derrell