LibreCat / Catmandu-MARC

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

Filter by indicator 2 in Catmandu::Fix::marc_map #28

Closed cKlee closed 8 years ago

cKlee commented 8 years ago

It is not clear how to filter by indicator 2 only, when indicator 1 is unknown or not important. I guess it should be done like

marc_map(245[ ,0], title)

An example of this in the POD and cheat sheet would be nice.

phochste commented 8 years ago

This is a bug and a documentation error

cKlee commented 8 years ago

Ok, with the comma it does not work. I was confused by the regex part:

(\[(.)?,?(.)?\])
phochste commented 8 years ago

It should be

(\[([^,])?,?([^,])?\])
cKlee commented 8 years ago

But why you need the

,?

Using a comma in the mac_path gets me an:

Oops! The fix 'marc_map' was called with missing or wrong arguments.
cKlee commented 8 years ago

Using a space like

245[ 0]

gets me an

Oops! Syntax error in your fixes...
phochste commented 8 years ago

You need to call it as:

marc_map("245[,2]a",title)

with the quotes. This only work in the current development release. There is a bug in the CPAN version which inteprets the above as ind1="," ind2="2"

cKlee commented 8 years ago

All right!