English 中文(简体)
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. 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.

问题回答

暂无回答




相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签