(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
and continue your work there. Thank you.

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Sep 2020, 01:27
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
HOWTO Use Perl on Puppy Linux Systems
Moderators: Flash, Ian, JohnMurga
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message

Joined: 22 Apr 2011
Posts: 16
Location: Melbourne, Australia

PostPosted: Sat 23 Apr 2011, 13:19    Post subject:  HOWTO Use Perl on Puppy Linux Systems  

Please review and correct this HOWTO as needs be. It is designed to be both suitable for newbies as well as detailed. As a consequence it is likely to be too long winded for the more experienced but the detail given will still likely provide some useful information.

HOWTO Use Perl on Puppy Linux Systems

Today's Puppy Linux systems contain a copy of Perl with the base operating system. At the time of writing this, I'm using Puppy 5.2.5. Perl has been in the main Puppy versions since about middle of 2006 onwards. Consequently, for most Puppy Linux systems you don't need to add anything to your operating system to write and run a standard Perl program so long as the Perl script doesn't use Perl's CPAN libraries.

From a Linux command console (such as the urxvt terminal emulator under the Utility menu) the command

perl -v

Will tell you the current version of your Perl if you have Perl installed.

The command

which perl

tells you where the Perl interpreter will execute from. Currently running this gives a response of the following:


This should be used on the first line of your Perl scripts with a Shebang (#!) placed before it to tell the system what compiler you are wanting to use. Many people place a space then a -w after it. This is the equivalent of adding the directive 'use warnings'. It is recommended to always add this directive and always add the 'use strict' directive. Consequently, the first line of your Perl script should have the following:

#!/usr/bin/perl  -w

My helloworld.pl file contains the following lines:

#!/usr/bin/perl  -w
use strict;
print "Hello World \n";

The Perl script files should have their flags set so that they are executable. From a Linux command console, after doing a cd to the directory containing the script, the scripts should be then executable by typing ./ following by the name of the script. For example:


For Linux you need the ./ in front of the file name unless the "." has been placed into your PATH variable. If you get the following style of error:

bash: ./helloworld.pl: Permission denied

then you probably haven't set the execute flag for this file. Note that with many puppy installations that share disk space with Microsoft Windows, the directories within /mnt/home or sda1 do not allow you to change the flags. In this area of the file system, Puppy simply assumes that all text files have the execute flags set. You only have to worry about the file's flags when the file is within Puppy's own file system such as files within the /root directory.

If you get a response of the following form:

bash: ./helloworld.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

or (if your script has the directive 'use warnings') just the following:

: No such file or directory

then the script file is probably formatted as an MSDOS file. You need to convert the line endings to Linux format. This problem occurs with Bash scripts also.

Note that with errors that relate to the filesystem such as 'No such file or directory', it can help to temporally comment out the use warnings directive to see if you get more helpful information from Bash.

From a Linux command console, after doing a cd to the directory containing the script, you can also execute the Perl script by a command in the following form:

 perl  helloworld.pl

This will work in a number of cases such as using MSDOS files where just typing ./helloworld.pl won't work.

By creating a small shell script you can have your perl script run from a single click without having to open a command console. Further, if you drag the shell script to the desktop you will create a shortcut icon on the desktop. Assume the above helloworld.pl file is placed in your ~/my-applications directory. In this case you can create a text file with the following lines:

tail -n +4 $0  > /tmp/myscript.txt
exec rxvt -e sh /tmp/myscript.txt
perl ~/my-applications/helloworld.pl

Change the fourth line so that it refers to your Perl script. You can save this shell script in a file named HelloWorld (or named anything else you like). Ensure that its flags are also set for it to be executable.

Click it from ROX-Filer or other file explorer program and it will run the helloworld.pl Perl script leaving a terminal window open with the output. Alternatively, drag the shell script to the desktop and you will create a shortcut icon on the desktop. If you right click this icon and select 'File <filename>' and then 'set icon...', you can setup your own image for this icon or for all icons for shell scripts. Also, if you right click this icon and select 'Edit Item', you can assign it a short cut key combination.

If you have an application where you don't need the terminal window left open then leave off the 'read' line in the above shell script. Special note for this shell script: Don't leave any blank lines within the first 3 lines of this script. You can get more information on this script from the following address:


Geany, the default text editor in the current Puppy, will recognize that a script is in Perl if the filename ends with .pl or if the first line starts with #!/usr/bin/perl Geany will then provide color coding to give Perl syntax highlighting. For the editing of Perl scripts it provides a number of useful features such as auto-indentation, go to tag definition and autocompletion. You can also directly run the Perl script from within Geany by selecting 'Execute' from the toolbar or from the Build menu or by depressing the F5 key.

You can also get Geany to automatically set the execute flag on any Perl script that it executes. To do this, first load a script that it recognizes as being Perl. Then select the 'Set Build Commands' from the Build menu. Under 'Execute Commands' to the right of the Execute Button you should see Perl "%f". Change this to the following and click the OK button.

chmod a+x "%f" && perl "%f"

Creating websites is one of the common uses for Perl. Consequently, it is worth pointing out a problem with the use of some Puppy's for website design. When Puppy uses Microsoft Windows filesystems, such as a Frugal shared disk installation, it does a fudge for the file permission flags. All permissions are given for those files. When you use an ftp client program such as gFTP to upload these files to a web server, those permission flags are normally copied to the web server with the file. These can be difficult to change on the server and this poses a security risk. I suggest that you shift the files to one of the subdirectories of /root before working on the files and before doing any uploads. This way you can keep an eye on and modify appropriately the permission flags before the files are uploaded. This applies to all files used on the web server, not just Perl scripts.

If you try to run a script that 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 error message should show the line of the Perl script that caused the problem. This line will probably have a 'use' statement something like the following example:

use LWP::UserAgent;

You need to download, compile and install the missing modules (as used in the 'use' statement) from the "Comprehensive Perl Archive Network" (ie. CPAN) or mirror thereof which is available over the internet. It is possible to manually download and install the needed modules but it is generally better to first install the CPAN perl module into your Perl. This module automates the download and installation. This includes finding and automatically installing any needed dependencies for the module.

Steps for this are as follows:

As most of the modules you download require compilation (from C or C++ source) you first need to update your copy of Puppy to include the developers compilers. (ie _devx_)

You may be able to do this with the quickpet program under the SFS-Get Tab

Otherwise, you can do it manually. For this you need to download the current _devx_ sfs file for your version of puppy (called lupu_devx_525.sfs for Puppy 5.2.5) into the installation and configure the boot manager to load it at startup. For live CD and Frugal installs the configure is as follows:

menu >>system >>bootmanager configure bootup >>>> Choose which extra sfs to load at bootup

Note: In a full hard drive partition installation (ext2, ext3 or ext4) there is a different means of installing the devx sfs file. See the following for more info:


The CPAN perl module looks for a large number of programs when it installs itself. When it doesn't find some of these it often has an alternative so getting errors relating to these doesn't always mean it won't work. One program it likes to use is the Lynx text based web browser. You are best to install this first. A puppy .pet copy can be obtained from


Download the .pet package, click on it and it will install itself. With my installation of the CPAN perl module, it didn't find ncftpget, ftp or applypatch programs but it is working alright without them. Now you can install the CPAN perl module.

With Puppy, you are already running as user root so you don't need to do a 'su root' as you would with other Unix Operating Systems. From a Linux command console just type the following.

perl -MCPAN -e shell

The first time it is run, it will ask you a bunch of configuration questions. For most people all of them can be answered with the default value (press <return>) including allowing it to install automatically. Don't be too concerned with errors relating to not being able to find things.

When finished it should come up with the cpan shell prompt as following:


The next time you run cpan, it will go directly to the cpan shell prompt. From the cpan shell enter h for help or q for quit back to the Linux command line.

You may want to make sure you have the latest and greatest CPAN perl module with all the trimmings. To do this, at the cpan shell prompt type the following command:

cpan> install Bundle::CPAN

Again, it will ask you many questions, which can normally be answered with the default value (press <return>) including allowing it to install automatically. Don't be too concerned with errors but you need to stay with it to keep pressing the return key when it needs it. It takes a long time to install. It keeps trying to use modules it hasn't installed yet but it will come back to these later. When finished you can quickly reload it as follows:

cpan> reload cpan

From the cpan command line you should be able to install any perl module with a single command. A standard install of a module is done with the standard install command. An example may be as follows:

cpan> install HTTP::Request

If it is already installed, it will tell you. In many cases you will want the complete bundle relating to the module. An example of a typical bundle install is as follows:

cpan> install Bundle::LWP

If cpan encounters any problems, it will not install the module. If you wish to force the install, then use the "force" command as in the following example:

cpan> force install Tk

Actually, the Tk module is a bad example as, without the force, it installed fine on my Puppy system. The Tk module provides a set of tools (widgets etc) to create Graphical User Interfaces (GUI) for your program. This is the same Tk as used in Tcl/Tk.

After quiting the CPAN module (with q) if you later wish to install an extra module you can simple re-enter CPAN again using the 'perl -MCPAN -e shell' command. It should just start without doing another install.

Installing a Perl module manually can be required in some instances. In this case, save it somewhere. From a command line change directory to where you saved it and enter commands of the following form (assuming the file is called Abc999.999.tar.gz).

gunzip Abc999.999.tar.gz
tar -xvf Abc999.999.tar
cd Abc999.999
perl Makefile.PL
make test
make install

The last line of this (make install) requires root privileges but you already have these with Puppy.

Some of the above information came from the book "Impatient Perl" by Greg London. This is a good book for getting up and running with Perl in a short time. The book is more suited for someone who already knows how to program in other languages. It is freely distributed under the GNU Free Documentation License. You can download it from the following website:


A good Tutorial on the Tk module can be downloaded from the following website:


From a Linux command console you can also use the man command to get information about or learn Perl. With the current Puppy, this is supplied from the internet into your browser. The Perl man manual has been split up into a large number of sections. Type 'man perl' and it lists the sections such as perlintro for an introduction to Perl or perlsyn for the Perl syntax. To get each section just type 'man' in front of the name of the section. For example, to get the Perl syntax type 'man perlsyn'.

Perl is a computer language that is mentioned in a very high number of computer job vacancies. While it is a good language, the real advantage of it probably lies more with the size and strength of the CPAN Archive of modules rather than the language itself. Given the high number of jobs in Perl, it is well worth spending some time learning the language.

Hope this is helpful
Ken Dawber
Back to top
View user's profile Send private message Visit poster's website 

Joined: 19 Apr 2011
Posts: 94

PostPosted: Wed 04 May 2011, 07:46    Post subject:  

Here is the link for full installs:
(installing the devx from the quickpet did not work for me. Save yourself the trouble and download it directly.)

So the solutions here worked for me so thanks. I just started to learn perl, like today, and some of the more recent tutorials used "say" instead of "print". I would get an error message when trying to activate it using
"use feature ':5.10';"
error message "can't locate feature.pm in .......blah blah
Interesting enough, either installing the devx or installing linx did the trick. Glad i tested it out before i downloaded the module, i don't i need it anymore. Now i can write:

say "Howdy Partner!"
instead of:
print "Howdy Partner!\n"

hopefully no more troubles or features missing from now on, though i still can't access the perl documentations using

i get: You need to install the perl-doc package to use this program

edit: i tried man perl as well, and no manual entry for perl
Back to top
View user's profile Send private message 

Joined: 07 Jul 2010
Posts: 896
Location: .ar

PostPosted: Mon 27 Feb 2012, 12:18    Post subject: Let's bring this post to life again :)  

Arrow General introduction:
perldoc perlintro

Arrow Syntax intro:
 perldoc perlsyn

Arrow You can get the whole official documentation as html only or html+pdf files in this site http://perldoc.perl.org/. Check you number version first.

Arrow If your Puppy has man on it, Debain repo has a "perldoc.deb" with man pages waiting for you (check the Perl version, Lenny package is the same perlversion that Quirky 1.2 and some Puppies 4xx).
Perl man pages are exactly the same information that perldoc's pod files; in fact, there are all made with 'pod2man' program.

Arrow A really good idea is install the module "Pod::Pdf" from CPAN, to create pdf files of the most used docs (like the perlfaqs).
With this, you can do something like:
pod2pdf `perldoc -l perfaq`

to create a pdf file from some pod (format of the perl's help files).
Then grab the pdf file:
cd `perldoc -l perlfaq`

Arrow For info in a function, use this command:
perldoc -f open

Arrow To see what modules you've added to your Perl so far, check this:
perldoc perllocal

Arrow To debug, i recommend to 'use diagnostics' (see `perldoc diagnostics`). But read the doc:
perldoc perldebtut

Arrow "$| = 1" means unbuffered, this can speed some tasks, and you can always set it to 0 again (it can mess some things too).

Arrow Regex resources.
Introductory tutorial:
perldoc perlre

perldoc perlrequick

A good, detailed tutorial:
perldoc perlretut

How Perl regex works?
perldoc perlreguts

References on meanings of operators, classes, context...
perldoc perlreref

Arrow Perl cames with a lot of modules and pragmas, you can get a list of those using:
corelist -v 5.10.1

Replace that number for the only of your version, as `perl -v` shows.

Arrow This one covers an ideal installation, not the real one, but still is useful:
perldoc perlmodlib
Also gives a list of CPAN mirrors, need to pass some to configure cpan app itself the very first time.

Arrow Lack of memory? Cheat! Cool
perldoc perlcheat
Back to top
View user's profile Send private message 

Joined: 24 Dec 2012
Posts: 77

PostPosted: Sun 19 May 2013, 11:06    Post subject:  

hello dear folks

i want to run puppy with

perl and addtional to the general perl-packages with

a. mozrepl and
b. www mechanize firefox

is this doable!?

can this be done with a live-version of puppy!?

love to hear from you

Back to top
View user's profile Send private message 

Joined: 07 Jul 2010
Posts: 896
Location: .ar

PostPosted: Mon 20 May 2013, 08:45    Post subject:  

I never installed mozrepl, but guess you can try. Firefox has been always around.
To use Perl in any Puppy, is recommended to have the devxxx.sfs up and running, as it has an almost full Perl (the lacking core modules are in it). To install cpan modules in Perl, I'd use
cpanp i WWW::Mechanize

(It will take some time if is the first time you use "App::cpanp".)
Be sure your pupsave has space and if it asks you about installing missing modules, choose "Yes to All".
Back to top
View user's profile Send private message 

Joined: 05 Aug 2006
Posts: 439

PostPosted: Mon 20 May 2013, 18:21    Post subject:  

to: sayhello_to_the_world
Download "precise-". There are perl and python were built in.
Back to top
View user's profile Send private message 

Joined: 24 Dec 2012
Posts: 77

PostPosted: Tue 25 Jun 2013, 22:59    Post subject:  

hello you both - good day dear gustavo and vanchutr

many many thanks for the quick reply.

vanchutr wrote:
to: sayhello_to_the_world
Download "precise-". There are perl and python were built in.

great to hear that.

i will tray out all your advices

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1043s ][ Queries: 11 (0.0426s) ][ GZIP on ]