[ic] Usertag return value

jimbo jimbo at soundimages.co.uk
Thu Feb 12 08:00:15 UTC 2009

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");

It seems to me you're trying to assign '$return' the value of 'return 0' 
in the case of failure. But 'return' can't be assigned to an lvalue, 
AFAIK. Even if it could, as soon as 'return 0' is called '$return' would 
go out of scope and you wouldn't be able to access it anyway.

If you want to use '$return' then you could write it like this:

   = $image->Write(filename=>'/file/location/'.$name.'_image.jpg');
return $return if ! $return;

   = chmod(0644,"/file/location/".$name."_image.jpg");
return $return if ! $return;


Jim Brewer
Sound Images
12 Whins Close
GU15 3NW
T +44 (0) 1276 64405
E jimbo at soundimages.co.uk
W http://www.soundimages.co.uk/

The information in this email is confidential and the contents are not
to be disclosed to anyone other than the addressee, except with their
permission. The opinions expressed represent those of the individual and
not necessarily those of Sound Images. If received in error please
advise the sender and remove from your system.

Sound Images does not guarantee this message, or any attachments, are
free from viruses or other defects.

More information about the interchange-users mailing list