gbv / PICA-Data

Perl module to handle PICA+ data
https://metacpan.org/release/PICA-Data
Other
6 stars 5 forks source link

Get rid of unblessed hash references #107

Closed nichtich closed 3 years ago

nichtich commented 3 years ago

I don't remember why I introduced the option bless. PICA Data given as hash reference with fields record and (optional) _id should always be blessed. Maybe Catmandu::PICA requires unblessed data structures?

nichtich commented 3 years ago

Implemented in version 1.27 (possibly breaking change). Will adjust Catmandu::PICA accordingly.

jorol commented 3 years ago

This broke Catmandu::Importer::SRU and Catmandu::Fix::search_sru:

$ catmandu convert -v SRU \
--base http://sru.gbv.de/opac-de-1 \
--recordSchema picaxml \
--query 'pica.xisb=9781501373930' \
--parser picaxml \
to JSON
Oops! encountered object 'PICA::Data=HASH(0x55e91d085808)', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /home/jorol/perl5/perlbrew/perls/perl-5.28.1/lib/site_perl/5.28.1/Catmandu/Exporter/JSON.pm line 36.
$ echo '{"isbn":"pica.xisb=9781501373930"}' |\
catmandu convert JSON to JSON \
--fix 'search_sru(isbn,"http://sru.gbv.de/opac-de-1",recordschema:picaxml,parser:picaxml)'
Oops! encountered object 'PICA::Data=HASH(0x55e0a2e8e720)', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /home/jorol/perl5/perlbrew/perls/perl-5.28.1/lib/site_perl/5.28.1/Catmandu/Exporter/JSON.pm line 36.

Versions:

nichtich commented 3 years ago

I've just release Catmandu::PICA 1.06 to fix this and other problems with Catmandu::PICA and PICA::Data >= 1.27.