John Bruin wrote:
I have inherited a Perl script which sends and parses email. I am having
trouble trying to figure out what the "-oi" and "-oem" arguments do in the
sub below. Can anyone help?
They are arguments for the program in $sendmail. First you have to find
out what $sendmail contains and then find the documentation for that
program to find out what "-oi" and "-oem" do.
sub mail(*) {
You really shouldn't use prototypes and you would be better off using
lexical variables for filehandles instead of typeglobs.
my $top = shift;
open(MAIL, "| $sendmail -t -oi -oem") or die "open: $!";
Better to use a list instead of a string:
open my $MAIL, '|-', $sendmail, '-t', '-oi', '-oem'
or die "Cannot open pipe from '$sendmail' $!";
$top->print(\*MAIL);
$top->print( $MAIL );
close MAIL;
You should also verify that the pipe closed correctly:
close $MAIL or warn $! ? "Error closing '$sendmail' pipe: $!"
: "Exit status $? from '$sendmail'";
}
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/