error text change with 10.22, printformat, and user defined tags

Started by StarGeek, July 10, 2016, 05:40:09 PM

Previous topic - Next topic

StarGeek

I started using 10.22 and encountered a change to the error text when using -p and user-defined tags that return undefined.

Under 10.13, I would get the error text
Warning: [Minor] Tag 'UserDefinedTag' not defined - FileName

Under 10.22, the error text is:
Warning: ValueConv UserDefinedTag: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) - FileName

-m suppresses the error under 10.13, but not under 10.22.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

OK.  This is due to a difference in the version of Perl.  It seems that you can no longer check to see if an array is defined.  The same thing happened for hashes in an earlier version of Perl.  But you likely don't want to check "defined(@array)" anyway.  To see if the array is empty, simply test "@array" to see if it is true (as the warning suggests).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on July 11, 2016, 07:48:29 AM
But you likely don't want to check "defined(@array)" anyway. 

I don't believe I was checking if an array was defined.  Here's a sample of a tag that throws the error.
UniqueKeywords => {
Require => 'Keywords',
ValueConv => q{
my @list = ref $val ? @$val : ($val);
my %seen;
my @new = grep{ ! $seen{ $_ }++ } @list;
return( join('',@list) ne join('',@new)  ? \@new : undef);
},         
},


And commands:
c:\>exiftool -keywords X:\!temp\Test5.jpg
Keywords                        : Keyword 1, Keyword 2, keyword 6

c:\>exiftool -p "$UniqueKeywords" X:\!temp\Test5.jpg
Warning: ValueConv UniqueKeys: Can't use 'defined(@array)' (Maybe you should just omit the defined()?) - X:/!temp/Test5.jpg

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

The ValueConv warning is for "UniqueKeys", but you have shown me the definition for "UniqueKeywords".  Is this a transcription error, or is there another definition causing this warning?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

D'oh, I did it again.  You are correct.  UniqueKeys is separate.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).