简体   繁体   English

从命令行运行Talend perl作业时丢失文件

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

I created a simple talend perl job to extract data from an excel file and place it in a mysql table. 我创建了一个简单的talend perl作业,以从excel文件中提取数据并将其放置在mysql表中。 This works fine when I run it in talend studio 4.1.1. 当我在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" $* perl -Ilib proj.job_import_prods_0.1.pl --context =默认--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. 无法在@INC中找到IO / Scalar.pm(@INC包含:/ home / antoniocs / programming / lib / etc / perl /usr/local/lib/perl/5.10.1 / usr / local / share / perl /在lib / OLE / Storage_Lite.pm行的5.10.1 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 / usr / local / lib / site_perl。) 171. BEGIN失败-在lib / OLE / Storage_Lite.pm第171行中编译失败。BEGIN失败-在lib / Spreadsheet / ParseExcel.pm第18行中require编译失败。 。在proj.job_import_prods_0.1.pl第568行的require中编译失败。BEGIN失败-在proj.job_import_prods_0.1.pl 568行中的编译中止。

I have already placed the ParseExcel.pm int the lib folder in the folder of the job. 我已经将ParseExcel.pm int lib文件夹放置在作业的文件夹中。 Is there no way talend will automatically add the necessary files to the job's folder? talend有没有办法自动将必要的文件添加到作业的文件夹?

NOTE: When exporting the job I checked the box "export dependencies" EXTRA NOTE: I am not a perl programmer. 注意:导出作业时,我选中了“导出依赖项”框。额外注意:我不是perl程序员。

You need to find the path where talend stores Perl modules (you cant just move files around). 您需要找到talend存储Perl模块的路径(不能随便移动文件)。 Once you know that, you can create a PERL5LIB environment variable to tell perl where the modules it is looking for are stored: 一旦知道了,就可以创建一个PERL5LIB环境变量来告诉perl它正在寻找的模块存储在哪里:

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 ). 快速find /where/talend/lives -name Scalar.pm应该会给您一个提示(您想要在IO之前的目录)。 If you wind up needing multiple directories, they can be separated with a : just like in the PATH environment variable. 如果你拉闸需要多个目录,它们可以用分开:就像在PATH环境变量。

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 . 或者,您可以从软件包管理器安装所需的模块(提示,RedHat样式框使用诸如perl-IO-Scalar之类的名称,而Debian样式框使用诸如libio-scalar-perl之类的名称)或CPAN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM