Hi Robin
You just might need to upgrade your Catmandu ("cpan Catmandu") to get the
fixed. You are probably using 0.9* syntax features with an older version of
Catmandu.
As for you second question. Yes, in Catmandu 0.9* all these combinations will
work:
my $fixer = Catmandu->fixer('do_this()', 'do_that()');
my $fixer = Catmandu->fixer(['do_this()', 'do_that()']);
my $fixer = Catmandu->fixer(fixer('name'); with 'name' as a section in a
catmandu.yml configuration file
You might want to join our librecat-dev mailing list where we regulary post
update and discuss technicall issues:
http://mail.librecat.org/mailman/listinfo/librecat-dev
Greetings from ELAG2014 in Bath
Patrick
From: Robin Sheat [ro...@catalyst.net.nz]
Sent: Wednesday, June 11, 2014 4:44 AM
To: perl4lib
Subject: Converting MARC fields with Catmandu - 'unless exists' failing.
I'm attempting to have a fixer that says "if this field hasn't already
been set, set it to "0", so I have:
unless exists('onloan')
add_field('onloan', '0')
end
This causes the error:
can't load fix unless exists('onloan')
add_field('onloan', '0')
end
: coercion for "_fixer" (constructor argument: "fix") failed: Bareword found
where operator expected at (eval 85) line 2, near ")
add_field"
It's possibly of note that the following from the cheat sheet fails
also:
unless exists('oogly')
upcase('foo') # foo => 'bar'
end
with the same form of error. (Also, that comment is probably incorrect.)
A related question:
When I have a fixer like this that is three lines long, and I'm passing
in an array of fixers to the Catmandu::Fix constructor, what do I do
with the multiline ones? Should it be three strings in the array, should
it one string all on one line, or should it be one string with embedded
newlines?
When I try the final option, I get the error:
Unsuccessful stat on filename containing newline at
/usr/share/perl5/Catmandu/Fix/Loader.pm line 33.
which is a standard Perl exception when you do a file operation on a
string with a \n anywhere that fails.
--
Robin Sheat
Catalyst IT Ltd.
✆ +64 4 803 2204
GPG: 5FA7 4B49 1E4D CAA4 4C38 8505 77F5 B724 F871 3BDF