ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: StarGeek on October 19, 2018, 06:37:19 PM

Title: Access variable defined outside of user defined tag
Post by: StarGeek on October 19, 2018, 06:37:19 PM
I just want to verify that I understand this correctly.

If I define a variable, in this case a large look up hash, outside of the tag I'm creating, in order to access it I have to use ValueConv => sub instead of ValueConv => q, correct?

I remember having to work thought this once before and I'm currently heading the same way and wanted to verify before I get to deep.
Title: Re: Access variable defined outside of user defined tag
Post by: Phil Harvey on October 19, 2018, 10:13:37 PM
I think you could access it via an enum too, but you couldn't use a file-scope variable defined by "my".   It should work to define a variable like this in the config file:

$Image::ExifTool::UserDefined::MyVariable = <initial value>

Then use $Image::ExifTool::UserDefined::MyVariable in your enum.

- Phil
Title: Re: Access variable defined outside of user defined tag
Post by: StarGeek on October 20, 2018, 02:20:11 PM
Ok

In this case I think I'm going to call a subroutine to do the look up, as it's easier for me to understand.  And use ValueConv => sub for the more complicated stuff.