From: Ilya Zakharevich Date: Fri, 6 Jun 1997 03:35:40 +0000 (+1200) Subject: perlbug under OS/2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4935d2c2574073146066c5d9b654a47d71a2cc2a;p=p5sagit%2Fp5-mst-13.2.git perlbug under OS/2 We actually check for return from sendmail (!), protect agains getpw* missing in Perl, and do some harder work under OS/2. Enjoy, p5p-msgid: 199707180333.XAA03102@monk.mps.ohio-state.edu --- diff --git a/utils/perlbug.PL b/utils/perlbug.PL index 9161488..2b11012 100644 --- a/utils/perlbug.PL +++ b/utils/perlbug.PL @@ -181,7 +181,11 @@ sub Init { )); # My username - $me = ($Is_MSWin32 ? $ENV{'USERNAME'} : getpwuid($<)); + $me = ( $Is_MSWin32 + ? $ENV{'USERNAME'} + : ( $^O eq 'os2' + ? $ENV{'USER'} || $ENV{'LOGNAME'} + : eval { getpwuid($<) }) ); # May be missing } @@ -718,6 +722,7 @@ sub Send { $fh->close; + print "\nMessage sent.\n"; } else { if ($Is_VMS) { if ( ($address =~ /@/ and $address !~ /^\w+%"/) or @@ -739,6 +744,18 @@ sub Send { { $sendmail = $_, last if -e $_; } + + if ($^O eq 'os2' and $sendmail eq "") { + my $path = $ENV{PATH}; + $path =~ s:\\:/: ; + my @path = split /$Config{path_sep}/, $path; + for (@path) { + $sendmail = "$_/sendmail", last + if -e "$_/sendmail"; + $sendmail = "$_/sendmail.exe", last + if -e "$_/sendmail.exe"; + } + } paraprint <<"EOF", die "\n" if $sendmail eq ""; @@ -761,12 +778,14 @@ EOF while() { print SENDMAIL $_ } close(REP); - close(SENDMAIL); + if (close(SENDMAIL)) { + print "\nMessage sent.\n"; + } else { + warn "\nSendmail returned status '",$?>>8,"'\n"; + } } } - - print "\nMessage sent.\n"; 1 while unlink($filename); # remove all versions under VMS