0

We have a spring boot application, which calls a perl script. It seems that the system variable PERL5LIB is not set in the context of the application, because the perl script compilation fails:

Can't locate JSON.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ...

(When I run the script in directly in the shell it works - because PERL5LIB is set properly.) I tried adding it to application.properties:

PERL5LIB=....

but this didn't work either. What am I doing wrong?

Ayelet
  • 1,713
  • 9
  • 29
  • 43

1 Answers1

1

I do not know spring-boot but it seems that application.properties is not suited to modify env varibles.

There are 3 options:

  1. set PERL5LIB globally before application starts (shell and WM can have different env vars)
  2. set PERL5LIB when calling scirpt
  3. use shell script to set PERL5LIB and call perl script, call that shell script from spring

The first two options depend on the way you run your spring app and the code you use to call external scripts. The third one should just work.

If it doesn't help please add the code from your app which calls external script.

UjinT34
  • 4,784
  • 1
  • 12
  • 26
  • This is Perl. [So there are even more than 3 options](https://stackoverflow.com/questions/2526804/how-is-perls-inc-constructed-aka-what-are-all-the-ways-of-affecting-where-pe) – mob Oct 25 '18 at 07:36