[wplug] Perl System Funcion
Jonathan Billings
billings at negate.org
Mon Sep 3 20:03:03 EDT 2007
Matthew T. Engel wrote:
> Something like System(“cd /home/$user/$web_root && ls), does an ls on
> /home/$user rather than /home/$user/$web_root. The system() function
> returns 0, I get the same thing if I try system(cd /home/$user && cd
> $web_root && ls).
I should also mention that the result of 0 is expected, when Perl is
speaking shell, zero == true and non-zero == false (unlike in other Perl
syntax). Yet another one of the quirks of Perl. (And in perl6, I
believe system() will return "0 but true" when the command returns
successfully . Fun.)
Since the cd and ls did not exit with an error (the directory existed,
and 'ls' will almost always return true in this context), the zero
result is not an anomaly.
--
Jonathan Billings <billings at negate.org>
More information about the wplug
mailing list