0

I am running into following error when running the script "perl create_board.pl" as cronjob,locate dashboard_config.pl is located in /local/mnt/workspace/user/Automation/swbuild/bin/board , I exported this path to ~/.bashrc but still runnig into this problem,I cannot add absolute path for dashboard_config.pl because it is present in multiple files, please suggest how to overcome this..

Can't locate board_config.pl in @INC (@INC contains: /swbuild/bin/board /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /local/mnt/workspace/gnakkala/Automation/swbuild/bin/dashboard/create_board.pl line 31
user3131197
  • 121
  • 1
  • 6

1 Answers1

0

How did you "export" the path ? It looks like perl loads the missing file using require, which means, that it looks in perls include path. From the error message it looks like that your path is not exported into this include path. Perl include path can be set in the environment with the PER5LIB or PERLLIB environment variable, syntax is similar to PATH.

Another possibility is, that you already set the include path using the environment variables, but that your script is running in taint mode (started with perl -T or first line beeing something like "#!perl -T"). In taint mode these environment variables are not used for security reasons and you have to modify the source or run it with "perl -Iinc_path program"

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • you are correct..the required missing file is using require..how to add it to PERL5LIB OR PERLLIB environment in UBUNTU..please suggest.. – user3131197 Jan 04 '14 at 20:59
  • in your .bashrc: PERL5LIB=$yourpath:$PERL5LIB – Steffen Ullrich Jan 04 '14 at 21:03
  • SO..IT SHOULD BE PERL5LIB=/local/mnt/workspace/user/Automation/swbuild/bin/board:$PERL5LIB – user3131197 Jan 04 '14 at 21:05
  • Added...export PERL5LIB=/local/mnt/workspace/user/Automation/swbuild/bin/dashboard:$PERL5LIB..didnot help?anything else we can try? – user3131197 Jan 04 '14 at 21:24
  • did you check if the file is tainted? – Steffen Ullrich Jan 04 '14 at 21:26
  • and I see, that you start create_board.pl, but create_all_dashboards.pl is throwing the error. So this file is somehow called from create_board.pl - maybe there is some messing with the environment in create_board.pl ? Does the error message include the newly added include path? – Steffen Ullrich Jan 04 '14 at 21:28
  • not it is not in tainted mode ,the newly added include path is not shown...i updated the errror...error is when running create_board.pl..somehow the newly added path is not getting included.. – user3131197 Jan 04 '14 at 21:35
  • just saw, that your problem is restricted to crontab. crontab will not read .bashrc, so you have to add the PERL5LIB setting to the crontab file, e.g. either on top of crontab as var=value or in front of the command as "var=value cmd" – Steffen Ullrich Jan 04 '14 at 21:39
  • see also http://stackoverflow.com/questions/17194632/perl-cant-find-module-when-run-from-cron-daily – Steffen Ullrich Jan 04 '14 at 21:41