in reply to Bad File Descriptor

You might try to get a slightly more meaningful error message like this:

open (MAIL, "|$mailProg") || die "Can't create pipe to $mailProg: $!";

$! should contain the error message as a string and die will announce more about the location of the error without the "\n" on the end. The documentation for both open and perlvar talk about $!.

Also, if you felt like doing things in the exceedingly modern perl-cool way, you'd write it like this:

open my $mailer, "|-", $mail_prog or die "couldn't open pipe to $mail_ +prog: $!";

Then $mailer will close itself when it goes out of scope and you don't pollute your package namespace with all-caps globs.

-Paul

Replies are listed 'Best First'.
Re^2: Bad File Descriptor
by mwhiting (Beadle) on Oct 23, 2007 at 20:42 UTC
    Yes - I did use the $! afterwards - sorry that wasn't in the code there. That's how I found out it was a "Bad File Descriptor" error message. Until then I didn't have anything. I saw the "|-" usage when I was looking into this problem too - maybe I'll change it to that. Any thoughts about the cause of the error message?

    Michael

      "Bad file descriptor" doesn't make sense as a failure reason for the code you posted. So I suspect your problem is something else. Please cut and paste some exact code that demonstrates the problem and the exact output that it produces.

      - tye        

        I agree the code itself looks OK. It works fine on other clients servers. That's why I mentioned about NT 2003 ... I thought there might be something different about that server type with permissions, etc.

        I will try the $^E to see what I get. It might be a couple of days before I get access to that server again.