LibreCat / Catmandu-MARC

Catmandu modules for working with MARC data
https://metacpan.org/release/Catmandu-MARC
Other
8 stars 10 forks source link

Use Catmandu::Fix::Base, deprecate Catmandu::MARC::Fix::Inline::* #27

Closed nichtich closed 8 years ago

nichtich commented 8 years ago

I don't know since when, but inline fixes are possible in Catmandu, if a fix is derived from Catmandu::Fix::Base (which Catmandu::MARC::Fix::* are not yet).

phochste commented 8 years ago

Catmandu::Fix::Base is only supported in Fixes that do 'emit'. Catmandu::MARC contains some non-emit fixes. I think this is an issue that should be solved in Catmandu::Fix::Base first.

phochste commented 8 years ago

Fixed in the dev branch. But Catmandu::MARC::Fix::Inline still has its use. All catmandu fixes normally change data inline. You would need to add a special construct to extract data

 use Catmandu::Fix::marc_map as => 'marc_map';

 my $result = marc_map($data, '245a','my_field')->{my_field);

In the Catmandu::MARC::Fix::Inline::marc_map you could say:

 my $result = marc_map($data,'245a');