On Tue, 26 Mar 2002, Blake Thornton wrote:
> >
> > I'm guessing it's output to stderr you are still seeing. Try
> >
> > chdir("/path/to/latex/files") or die "chdir failed: $!\n";
> > my $rc = system("latex filename.tex > /dev/null 2>&1");
> >
>
> Beautiful!!  It worked great.
>
> Can you (or anyone else) explain to me the command
>       my $rc

Well, based on your comment, I'd suggest you do some reading in general
(the perl man pages are really good, in this case 'man perlfunc', and
there are lots of other good perl resources).

The system command returns the exit status of the program executed. I
captured that above in a variable called $rc. The my keyword controls it's
scope (no time to explain that now :)

Anyway, the return code is actually the code "wait" returns, and you need
to divide by 256 to get the actual value. You would do something like

$rc = $rc>>8;
if ( $rc != 0 ) {
        print "Yikes, the system call failed!\n";
}

Read up on the system command. There are things you should be aware of
regading security thta you should be aware of too, as well as you should
always check the exit code to determine if it was a success.

hth
charles



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to