Solving Perl Script Executable Related Errors - Also HOWTO Use Perl on Puppy Linux Systems - Newer Version

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
nathan-sr
Posts: 33
Joined: Thu Apr 07, 2022 10:12 am
Has thanked: 26 times
Been thanked: 17 times

Solving Perl Script Executable Related Errors - Also HOWTO Use Perl on Puppy Linux Systems - Newer Version

Post by nathan-sr »

If you try to run a Perl Script Executable ( with the default perl installed on puppy linux systems ) which requires any CPAN library modules, that you haven't installed, then you will get an error message that starts with something like the following:

Can't locate MODNAME/Submod.pm in @INC (@INC contains: ...

The solution to this is very simple:

install a portable, fully self-contained copy of perl first, into your home directory ( internet connection required first ):

Code: Select all

curl -fsSL https://git.io/perl-install | bash -s ~/perl

This installs the latest relocatable perl to ~/perl.

Output:

Code: Select all

Installing perl 5.36.0.0 to /root/perl, this may take a while...
Successfully installed perl 5.36.0.0.
To use this perl, add the following line to ~/.bash_profile or ~/.zshrc:

  export PATH=/root/perl/bin:$PATH

Now, use the following commands:

Code: Select all

echo 'export PATH=/root/perl/bin:$PATH' >> ~/.bashrc

tail ~/.bashrc

Alternatively, use geany to add it :

geany ~/.bashrc

After installing portable perl, start a new terminal window, and then:

Code: Select all

~# which perl
/root/perl/bin/perl

Also, I will give you the steps to install a Very Useful Perl Script Executable, called parallel, which runs commands parallely, on multiple processors, multiple servers/systems etc.

Google search for GNU Parallel to know more about this utility.

The installation of this utility on puppy linux, using the package manager, gives us a much older version.
Secondly, using it fails with the following error:

Code: Select all

~# which parallel
/usr/bin/parallel

~# parallel --version
Can't locate IPC/Open3.pm in @INC (you may need to install the IPC::Open3 module)

cpan required for installing perl modules was missing as well

~# file /usr/bin/parallel
 parallel: Perl script text executable

After installing portable perl with the steps above:

Code: Select all

~# which perl
/root/perl/bin/perl

~# parallel --version
GNU parallel 20161222

Then download the latest Community maintained package for GNU Parallel for your OS from here: https://www.gnu.org/software/parallel/

Debian Unstable Package works fine on the Puppy Linux ( tested on Bionicpup 64 )

Then extract the parallel*.deb file or else
use the portable parallel utility ( that i am attaching here ) to /root and
then cd to its usr/bin folder and then try a sample parallel command:

Code: Select all

# the below commands are run from a pen drive, i.e. sdc1 in this case for portability purposes
cd /mnt/sdc1/parallel_utility/usr/bin
find . -maxdepth 1 -iname "*.sh" -print0 | ./parallel -0 "sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/\"/\&quot;/g; s/'\"'\"'/\&#39;/g' {} > {}_Html_Passed.txt"
ls -ltr

Explanation:

Code: Select all

The above sed command reads each file, performs multiple substitutions of html sensitive/special characters, 
parallely with the help of the parallel command and writes them to a corresponding new output file.

Also note that double quotes inside the sed command need to be escaped with a \ as the 
parallel command itself needs them.

The find command's -maxdepth value can be adjusted to our needs.

This code will also help those who want to publish their scripts of any kind, on their websites, 
without getting them affected by the browser's rendering of it. Also, using the pre tags of html 
to surround their scripts will help.

Also:

Code: Select all

./parallel --version
GNU parallel 20220522

The parallel bin folder contains a sample shell script to test.

Hope this post helps for solving errors related to Perl Executables and for installing and trying out new ones.

Attachments
parallel.pdf
(462.42 KiB) Downloaded 39 times
parallel_utility.zip
(185.66 KiB) Downloaded 34 times
Portable-Perl-README.md.txt
(2.23 KiB) Downloaded 34 times
Last edited by nathan-sr on Mon May 30, 2022 2:55 am, edited 2 times in total.
User avatar
rockedge
Site Admin
Posts: 6525
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2738 times
Been thanked: 2616 times
Contact:

Re: Solving Perl Script Executable Related Errors - Also HOWTO Use Perl on Puppy Linux Systems - Newer Version

Post by rockedge »

Also very easy to expand the PERL already available in Puppy Linux is to load the devx.sfs first for that distro. Then install cpanminus the PERL module installer, like this in a terminal:

Code: Select all

cpan App::cpanminus

answer YES to both prompts.

Now let's say you need to install the PERL modules LWP::UserAgent and DBD::mysql :

Code: Select all

cpanm LWP::UserAgent
cpanm DBD::mysql
Post Reply

Return to “Users”