[ic] Usertag return value

Peter peter at pajamian.dhs.org
Fri Feb 13 04:56:21 UTC 2009


On 02/12/2009 06:52 PM, Grant 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");
> 
> I tried this with the same results.  The first 3 commands execute, the
> last 3 commands don't execute, and the usertag exits with '0'.  If I
> remove:
> 
> return 0
>   if !
> 
> everything executes, but I don't get the '0' in case of failure.

So, you want all commands to execute regardless and the tag to return 0
if any command fails?

ok, do it this way, then:

my $retval = 1;
command_1 or $retval = 0;
command_2 or $retval = 0;
command_3 or $retval = 0;
...
command_n or $retval = 0;

return $retval;



Peter




More information about the interchange-users mailing list