gbv / Catmandu-PICA

Catmandu modules for working with PICA+ data
https://metacpan.org/release/Catmandu-PICA
Other
4 stars 4 forks source link

pica_add() doesn't work if hash key 'record' not exists #77

Closed jorol closed 1 year ago

jorol commented 2 years ago
$ echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'pica_add(title,021A$a)'
PICA record must be array reference
$  echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'pica_add(title,021A$a,record:"pica")'
PICA record must be array reference
$echo '{"title":"code4lib"}' | catmandu convert JSON to YAML --fix 'pica_add(title,021A$a)'
---
title: code4lib
...

Works if key is defined beforehand:

echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'set_array(record);pica_add(title,021A$a)'
021A $acode4lib
nichtich commented 1 year ago

I'll create pica_update(PATH, value) instead and depracte pica_add because of the order of arguments (see #82).

nichtich commented 1 year ago

Fixed in 1.14 to be released today.