Hi,
I am trying to copy content of xmp:HierarchicalSubject field to another field (in this case, Subject) while performing some string substitutions.
This works fine from one liner like:
exiftool "-xmp:Subject<${HierarchicalSubject;s/\|/\//g}" image.jpg
This replaces every pipe with slash.
When I am trying same by using config file, I can't get ValueConv working properly:
%Image::ExifTool::UserDefined = (
# .....
'Image::ExifTool::Composite' => {
MyCreateSubject => {
Require => 'HierarchicalSubject',
ValueConv => '$val =~ s/\|/\//g; $val',
},
},
# ....
);
#------------------------------------------------------------------------------
1; # end
When executing exiftool.exe -config myconfig.txt "-Subject<myCreateSubject" image.jpg, the result is plain copied value. It seems that I can't get string substitution to work, the output will always be unmodified value of $val.
I have tried also different formats like s#|#/#g with no success.
Maybe I should put an example of this in the sample config file. There are various examples (like this) (https://exiftool.org/forum/index.php/topic,3945.msg18390.html#msg18390) on the forum with examples of how to loop through the individual list items in a UserDefined Composite tag definition.
- Phil
Thank you!
That solved the problem :)