0

I am copying the following systemd service file from an old server to a new one. I'm new to perl, and trying to understand what else needs to move with the service file (aside from the /usr/local/assp contents).

The file contains a PERL5LIB= line and I'm not sure what this does or if it's needed. The old server did have files in /root/perl5/lib/perl5 though I'm not sure what this is for, and the new server does not have this dir. The old server was CentOS7 (perl 5.16.3), while the new one is AlmaLinux9 (perl 5.32.1). I'm guessing this has something to do with compatibility but can't figure it out.

Do I need to recreate this dir? Do I need to change the PERL5LIB line?

[Unit]
Description=AntiSpam SMTP Proxy
After=network.target

[Service]
Type=
Environment=PERL5LIB=/root/perl5/lib/perl5/
ExecStartPre=-rm -f /usr/local/assp/pid
ExecStart=/usr/bin/perl /usr/local/assp/assp.pl /usr/local/assp/
ExecStopPost=-rm -f /usr/local/assp/pid

[Install]
WantedBy=multi-user.target

1 Answer 1

0

With perl your program can include lines such as use IO;. This tells the language to load in modules.

There is a default path to find these libraries (which you can see with perl -V).

However if you manually place libraries outside of those areas (very common) then you need to tell perl where to find them. This can be done inside the code by modifing @INC, or you can set the PERL5LIB environment variable (or the PERLLIB variable, for that matter).

By setting PERL5LIB=/root/perl5/lib/perl5/ it means that if your program does use xyzzy; then it will look for /root/perl5/lib/perl5/xyzzy.pm as well as the default locations.

As to whether you need this variable set in your new environment, it will depend on what /usr/local/assp/assp.pl needs. We can't answer that.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.