Use eval and check $@ for error checking.
--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]
From: "Paul Kraus" <[EMAIL PROTECTED]>
To: "'Perl'" <[EMAIL PROTECTED]>
Subject: Return Status
Date: Tue, 10 Dec 2002 17:27:36 -0500
instead of setti
On Dec 10, Paul Kraus said:
>instead of setting my own $error can I instead just check if &mount
>completed ok? Is there a better way to do this?
Sure.
>sub mount{
>!system
>"mount","-t","smbfs","-o","username=$ini{$section}{username},password=$i
>ni{$section}{password}",
>
>"//$ini{$sec
Yes, just return a true (1) or false (0) value...
foreach (@junk) {
next unless mount(); # next on error
... do stuff ...
}
sub mount{
... do stuff ...
return $return_code;
}
...OR...
sub mount{
... do stuff ...
# return the negated return value
return ! system(...);
}
...OR...