problem with config file, change between ver 11.53 and 11.54

Started by StarGeek, July 24, 2019, 02:23:58 PM

Previous topic - Next topic

StarGeek

My GPS2MapUrl.config file, which previously worked, currently returns an error:
Warning: ValueConv GoogleMapsUrl: Can't use an undefined value as a HASH reference

I narrowed it down to the changes between version 11.53 (still works) and 11.54 (returns error).

The command is
exiftool_11.54.exe -config GPS2MapUrl.config  -GoogleMapsUrl y:\!temp\Test4.jpg
but it  also fails with
exiftool_11.54.exe -config GPS2MapUrl.config  -GoogleMapsUrl -userparam zoom=12 y:\!temp\Test4.jpg

The basic code of the config file is (full config file in the above link)
GoogleMapsUrl => {
Require => {
0 => 'GPSLatitude',
1 => 'GPSLongitude',
},
ValueConv => q{
my $zm = ($self->Options('UserParam')->{'zoom'}) ? "&ll=$val[0],$val[1]&z=".($self->Options('UserParam')->{'zoom'}) : undef;
return ("https://www.google.com/maps/search/?q=$val[0],$val[1]$zm");
},
},


So I'm guessing the problem is with the $self->Options('UserParam')->{'zoom'} part, which is the only hash part, as far as I can tell, but it also fails when I include the UserParam, so I'm at a bit of a loss as how to fix it.

* 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

Thanks for this report!  It will be fixed in 11.58.

Really good catch.

I introduced this bug when I added a patch to support backward compatibility for the old Compact and XMPShorthand options.

- Phil

Edit:  Note that even with 11.53, your config file will return a warning about an uninitialized value under some circumstances (eg. exiftool -p "$test" FILE). Instead of "undef", you should set $zm to an empty string if there is no "zoom" parameter.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on July 24, 2019, 04:15:38 PMyou should set $zm to an empty string if there is no "zoom" parameter.

Sounds good.  I'll fix that later today.
* 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).