Jeremy Redburn <[EMAIL PROTECTED]> writes: >Jeremy Redburn wrote: >>> >>> What happens - what does $! show? >> >> >> I have this statement in my code: >> >> print STDERR "Testing" || print LOG "Error: $!" >> >> Nothing gets printed to the terminal, and LOG doesn't have any content. >> I can print to LOG fine if I do it directly. >> > >Thanks to Garry Williams, I realized this of course will not work. When >I change '||' to 'or' I do get an error: > >Error: Bad file descriptor
So you get that written to LOG? > >Any ideas? Well something has closed (or failed to open) the POSIX-level numeric file descriptor associated with that context's STDERR. In a normal non-threaded perl that would be fd 2. But I _think_ that for complicated reasons in a threaded perl each thread - or rather each context - gets a dup()ed fd. (Complicated means I don't remember without re-reading the code ;-)) So one possibility is you just ran out of numeric fds for the number of threads/contexts you created (e.g. IIRC Solaris by deafault only has 256 fds 0..255 for compatibility reasons.)