[librecat-dev] Catmandu::Fix removes paths from variables

Mayr-Duffner, Georg georg.mayr-duffner at wu.ac.at
Wed Jun 20 11:11:01 CEST 2018


Hi Johann,

I've tried to reduce script and fix file to a minimum to show my troubles. The file path is absolute, yet I constantly get errors. I attach script and fix file and at the bottom is the output:

Best regards
Georg

*** Output ***

PS W:\Users\gduffner\Docs\Documents\Alma\UBL> perl .\test.pl -d -i .\marc\test.mrc
2018/06/20 11:03:11 [7524] - INFO main:: .\test.pl (34) time=0 : Starting main program
2018/06/20 11:03:11 [7524] - INFO main:: .\test.pl (34) time=0 : Starting main program
csv-file path is W:\Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv
2018/06/20 11:03:11 [7524] - DEBUG Catmandu::Env::BUILD C:/Private/gduffner/dev/perl/perl/site/lib/Catmandu/Env.pm (96)
time=24 : $VAR1 = {};
2018/06/20 11:03:11 [7524] - ERROR Catmandu::Error::BUILD C:/Private/gduffner/dev/perl/perl/site/lib/Catmandu/Error.pm (
30) time=145 : Syntax error in your fixes...
Error: Expected end of input on line 2 at:
marc_set('999a',W:\Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv)
^
Source:
        marc_set('LDR/6', 'a')
        marc_set('999a',W:\Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv)

Trace begun at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix\Parser.pm line 104
Catmandu::Fix::Parser::catch {...} ('Parser::MGC::Failure=HASH(0x3ab2c20)') called at C:\Private\gduffner\dev\perl\perl\
vendor\lib\Try\Tiny.pm line 123
Try::Tiny::try('CODE(0x4c16a18)', 'Try::Tiny::Catch=REF(0x2e2cd28)', 'Try::Tiny::Finally=REF(0x2c0c648)') called at C:\P
rivate\gduffner\dev\perl\perl\site\lib\Catmandu\Fix\Parser.pm line 108
Catmandu::Fix::Parser::parse('Catmandu::Fix::Parser=HASH(0x3abe800)', 'marc_set(\'LDR/6\', \'a\')^Jmarc_set(\'999a\',W:\
Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv)^J') called at C:\Private\gduffner\dev\perl\perl\site\lib\
Catmandu\Fix.pm line 94
Catmandu::Fix::_build_fixes('Catmandu::Fix=HASH(0x3d5be78)') called at (eval 88) line 20
Catmandu::Fix::fixes('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.
pm line 217
Catmandu::Fix::emit('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.p
m line 107
Catmandu::Fix::_build_fixer('Catmandu::Fix=HASH(0x3d5be78)') called at (eval 83) line 20
Catmandu::Fix::fixer('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.
pm line 177
Catmandu::Fix::fix('Catmandu::Fix=HASH(0x3d5be78)', 'Catmandu::Importer::MARC=HASH(0x453b758)') called at test.pl line 5
7
Expected end of input on line 2 at:
marc_set('999a',W:\Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv)
^

Trace begun at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix\Parser.pm line 104
Catmandu::Fix::Parser::catch {...} ('Parser::MGC::Failure=HASH(0x3ab2c20)') called at C:\Private\gduffner\dev\perl\perl\
vendor\lib\Try\Tiny.pm line 123
Try::Tiny::try('CODE(0x4c16a18)', 'Try::Tiny::Catch=REF(0x2e2cd28)', 'Try::Tiny::Finally=REF(0x2c0c648)') called at C:\P
rivate\gduffner\dev\perl\perl\site\lib\Catmandu\Fix\Parser.pm line 108
Catmandu::Fix::Parser::parse('Catmandu::Fix::Parser=HASH(0x3abe800)', 'marc_set(\'LDR/6\', \'a\')^Jmarc_set(\'999a\',W:\
Users\gduffner\Docs\Documents\Alma\UBL\data\iso3166H2marc.csv)^J') called at C:\Private\gduffner\dev\perl\perl\site\lib\
Catmandu\Fix.pm line 94
Catmandu::Fix::_build_fixes('Catmandu::Fix=HASH(0x3d5be78)') called at (eval 88) line 20
Catmandu::Fix::fixes('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.
pm line 217
Catmandu::Fix::emit('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.p
m line 107
Catmandu::Fix::_build_fixer('Catmandu::Fix=HASH(0x3d5be78)') called at (eval 83) line 20
Catmandu::Fix::fixer('Catmandu::Fix=HASH(0x3d5be78)') called at C:\Private\gduffner\dev\perl\perl\site\lib\Catmandu\Fix.
pm line 177
Catmandu::Fix::fix('Catmandu::Fix=HASH(0x3d5be78)', 'Catmandu::Importer::MARC=HASH(0x453b758)') called at test.pl line 5
7



> -----Ursprüngliche Nachricht-----
> Von: Rolschewski, Johann <Johann.Rolschewski at sbb.spk-berlin.de>
> Gesendet: Montag, 18. Juni 2018 10:55
> An: Mayr-Duffner, Georg <georg.mayr-duffner at wu.ac.at>; librecat-
> dev at lists.uni-bielefeld.de
> Betreff: AW: Catmandu::Fix removes paths from variables
> 
> Hi Georg,
> 
> > we are storing some csv files that we need in different contexts in a
> specific data folder and to access them from a fix file we define
> variables like this:
> >
> > my $fixer = Catmandu::Fix->new(
> >     variables => { MARC2ISO => 'path/to/marc2iso.csv',
> >                  },
> >     fixes => [$fixfile],
> > );
> >
> > In the fixfile, the csv file is called like this:
> >
> > lookup("country", {{MARC2ISO}}, sep_char:'|')
> >
> > However, we constantly get errors because catmandu can't find the
> file. It seems that the path is thrown away.
> 
> I can't reproduce your error. Could you please add a
> 'add_field(PATHVAR,{{MARC2ISO}})' to your fix file and check the value
> after transformation?
> Are you using absolute or relative paths for your dictionaries?
> 
> Best,
> 
> Johann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.fix
Type: application/octet-stream
Size: 30 bytes
Desc: test.fix
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20180620/1d5bb887/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pl
Type: application/octet-stream
Size: 1336 bytes
Desc: test.pl
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20180620/1d5bb887/attachment-0001.obj>


More information about the librecat-dev mailing list