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.
OK, thanks. I'll look into this.
- Phil
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
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
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
D'oh, I did it again. You are correct. UniqueKeys is separate.
:)