[ic] Usertag return value
Stefan Hornburg (Racke)
racke at linuxia.de
Thu Feb 12 08:26:45 UTC 2009
jimbo wrote:
> Gert van der Spoel wrote:
>
>>> $return= $image->Write(filename=>'/file/location/'.$name.'_image.jpg')
>>> or return 0;
>>> $Tag->log("1: return=$return error=$!");
>>> $return= chmod(0644,"/file/location/".$name."_image.jpg") or return 0;
>>> $Tag->log("2: return=$return error=$!");
>
> Why not write it like this:
>
> return 0
> if ! $image->Write(filename=>'/file/location/'.$name.'_image.jpg');
>
> return 0
> if ! chmod(0644,"/file/location/".$name."_image.jpg");
unless (chmod(...)) {
return 0;
}
is much more readable and you can also capture the return value with:
unless ($ret = chmod(...)) {
return 0;
}
Regards
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team
More information about the interchange-users
mailing list