in reply to Re: Re: Re: Re: Small Net::SMTP problem
in thread Small Net::SMTP problem

This thing is really kicking my butt... if I use the following, the "Bad command..." error still appears:
use Net::SMTP; open(OLDOUT, ">&STDOUT"); close(STDOUT); my $smtp = Net::SMTP->new('relay.utah-inter.net'); open(STDOUT, ">&OLDOUT");
...and if I use this...
use Net::SMTP; open(OLDERR, ">&STDERR"); open(STDERR, "nul"); eval { my $smtp = Net::SMTP->new('relay.utah-inter.net') }; open(STDERR, ">&OLDERR"); die $@ if $@;
...then another console window opens containing "Bad command or filename," and the process just runs forever until I terminate it. Crazy stuff.

Alan "Hot Pastrami" Bellows

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Small Net::SMTP problem
by chipmunk (Parson) on Dec 02, 2000 at 01:46 UTC
    Darn... Okay, how about opening STDERR to a file, then closing the file and deleting it? It's not pretty, but it may work.
    use Net::SMTP; my $tmpfile = "$ENV{TMPDIR}/stmp.$$"; # Or use a module like File::T +emp open(OLDERR, ">&STDERR"); open(STDERR, ">$tmpfile"); eval { my $smtp = Net::SMTP->new('relay.utah-inter.net') }; close(STDERR); open(STDERR, ">&OLDERR"); unlink($tmpfile); die $@ if $@;
    And here's a link to the File::Temp module.