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')

This causes the error:

can't load fix unless exists('onloan')
   add_field('onloan', '0')
: coercion for "_fixer" (constructor argument: "fix") failed: Bareword found 
where operator expected at (eval 85) line 2, near ")

It's possibly of note that the following from the cheat sheet fails

unless exists('oogly')
  upcase('foo') # foo => 'bar'

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

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

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to