Prepare Your Perl Scripts for 11.36

In 11.36, cPanel will ship with a distribution of Perl 5.14.3. This version of Perl will be located inside the /usr/local/cpanel tree to avoid problems with the RPMs provided by the distro. While the installer will still require basic Perl, cPanel will no longer need /usr/bin/perl in order to function. System administrators will have the option to have the cPanel installer remove /usr/bin/perl all together. The cPanel code and /usr/bin/perl will have minimal interaction.

Warning: If the distro’s core Perl does not provide the modules, then you may need to change your shebang at the top of your scripts. This pertains especially to new installs. You will need to change your shebang if:

  • Your scripts need to work on all versions of cPanel (including 11.36).
  • Your maintenance scripts tie into the cPanel code.
  • You want to use Perl 5.14.

Based on specific needs, we recommend the following two options to change #!/usr/bin/perl at the beginning of your script:

Option 1: If the script needs to function in all versions of cPanel (including versions where Perl 5.14 wasn’t provided), we recommend the following:


#!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;'
if 0;

#!/usr/bin/perl

Option 2: If the script needs to function only in 11.36 and later versions, you can simply change all of your scripts to point to the new version of Perl:


#!/usr/local/cpanel/3rdparty/bin/perl

Note: While /usr/local/cpanel/3rdparty/bin/perl is a symlink, we do not recommend that you use the binary that the symlink points to. This binary could be removed when a new version of Perl is issued.

Want to make sure you receive email updates with important information so you are always in the know? Join our mailing list here:http://cpanel.net/mailing-lists/

Posted in: News