Prepare Your Perl Scripts for 11.36

cPanelToddR

Member
Staff member
Oct 8, 2009
21
1
128
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:

Code:
#!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"[email protected]"}; else exec /usr/bin/perl -x $0 ${1+"[email protected]"}; 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:

Code:
#!/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.