开发者

Missing files when running a Talend perl job from the command line

开发者 https://www.devze.com 2023-01-30 00:30 出处:网络
I creat开发者_JAVA技巧ed a simple talend perl job to extract data from an excel file and place it in a mysql table.

I creat开发者_JAVA技巧ed a simple talend perl job to extract data from an excel file and place it in a mysql table. This works fine when I run it in talend studio 4.1.1.

The problem is when I export the job. I try to run it like so:

perl -Ilib proj.job_import_prods_0.1.pl --context=Default --context_param file_path="/home/antoniocs/programming/file.xls" $*

This gives me the following errors:

Can't locate IO/Scalar.pm in @INC (@INC contains: /home/antoniocs/programming/ lib /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at lib/OLE/Storage_Lite.pm line 171. BEGIN failed--compilation aborted at lib/OLE/Storage_Lite.pm line 171. Compilation failed in require at lib/Spreadsheet/ParseExcel.pm line 18. BEGIN failed--compilation aborted at lib/Spreadsheet/ParseExcel.pm line 18. Compilation failed in require at proj.job_import_prods_0.1.pl line 568. BEGIN failed--compilation aborted at proj.job_import_prods_0.1.pl line 568.

I have already placed the ParseExcel.pm int the lib folder in the folder of the job. Is there no way talend will automatically add the necessary files to the job's folder?

NOTE: When exporting the job I checked the box "export dependencies" EXTRA NOTE: I am not a perl programmer.


You need to find the path where talend stores Perl modules (you cant just move files around). Once you know that, you can create a PERL5LIB environment variable to tell perl where the modules it is looking for are stored:

PERL5LIB=/path/to/modules perl -Ilib proj.job_import_prods_0.1.pl --context=Default --context_param file_path="/home/antoniocs/programming/file.xls" $*

A quick find /where/talend/lives -name Scalar.pm should give you a clue (you want the directory before IO). If you wind up needing multiple directories, they can be separated with a : just like in the PATH environment variable.

Alternatively, you can install the required modules from your package manager (hint, RedHat style boxes use names like perl-IO-Scalar and Debian style boxes use names like libio-scalar-perl) or CPAN.

0

精彩评论

暂无评论...
验证码 换一张
取 消