PERL Info

From TheBestLinux.com
Revision as of 10:44, 3 February 2018 by Jamie (talk | contribs)
Jump to navigation Jump to search

Perl Module Information

Perl is one of my favorite scripting languages and has a lot of available modules with which to assist & expand it's functionality!

CPAN Install Information

This is just an example:

perl -MCPAN -e 'install HTML::Template' 



CPAN Module Installation from Source Code

Sometimes, due to the required/desired Perl module is not easily available via the standard command line "MCPAN..." command, or you want to force a specific version or tweak the module's way it works, allowing for total customization, it's preferable to manually install a Perl module from source code after downloading and compiling. Here are the basic to do it yourself. I will use the same Perl module, HTML::Template, referenced in the previous example above.

The first thing to do is download the actual source code files required to compile, also referred to "building" the source code into an executable binary most people are accustomed to running. But before downloading the "tarball", which is the Linux/UNIX equivalent to a .Zip archive, it's best practice to first create a directory/folder on the computer's hard drive to store the "tarball" file archive which contains all of the files required to "build", aka "compile", the files into the required binary which is the format the computer needs in order to "run" the application, whatever that may be.

All of these examples are intended to be run from a command line, so from the Linux X-Windows GUI, so be sure to perform all of these steps within a "Terminal", assuming you have booted into and logged into the Linux graphical environment, X-Windows. If you unfortunately have to remotely log into the Linux machine from a M$ Windoze box, you can still easily do so using PuTTY. Please check out my PuTTY & SuperPuTTY wiki page for more info! :P~


These detailed steps assume you are using a standard Red Hat Linux based distribution(Distro) running the default Gnome desktop environment. If you are running some other desktop environment such as KDE, XFCE, etc, please adjust these instructions accordingly.

First, open up a Terminal window. On the Gnome desktop environment, move your mouse to the far upper left corner of the monitor screen, and then "normal left-click" on "Activities" in the far upper left corner of the screen. That will pull up the "Favorites" bar on the far left side of the screen, with a button at the very bottom left to "Show Applications". Click on this button, and then scroll down to the very bottom/last screen of icons and click on the "Utilities" icon, which will open up a sub-menu window, which among others will have the "Terminal"icon. Click on the Terminal icon to start up a new Terminal window. You will then have a command line window, similar to a Windows/DOS Command(cmd) window, but having a little different format for the command prompt, such as seen here on my laptop:

[jamie@dell-1640 ~]$  



Here's a screenshot of the actual terminal window on one of my laptops running Fedora 27:

Terminal Screenshot-001.jpg





Create a new directory to download the "tarball" file archive into:

[jamie@dell-1640 ~]$ mkdir /home/jamie/Development/Perl/CPAN_Module_Sources/MyWiki_HowTo/HTML_Template/SRC
[jamie@dell-1640 ~]$ cd /home/jamie/Development/Perl/CPAN_Module_Sources/MyWiki_HowTo/HTML_Template/SRC
[jamie@dell-1640 SRC]$ wget http://search.cpan.org/CPAN/authors/id/S/SA/SAMTREGAR/HTML-Template-2.97.tar.gz

This should download the tarball into the newly created directory you previously created. Here is the scroll-back from my example:

--2018-02-02 18:26:11--  http://search.cpan.org/CPAN/authors/id/S/SA/SAMTREGAR/HTML-Template-2.97.tar.gz
Resolving search.cpan.org (search.cpan.org)... 207.171.7.49, 207.171.7.49
Connecting to search.cpan.org (search.cpan.org)|207.171.7.49|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.cpan.org/authors/id/S/SA/SAMTREGAR/HTML-Template-2.97.tar.gz [following]
--2018-02-02 18:26:12--  http://www.cpan.org/authors/id/S/SA/SAMTREGAR/HTML-Template-2.97.tar.gz
Resolving www.cpan.org (www.cpan.org)... 151.101.54.49, 2a04:4e42:d::561
Connecting to www.cpan.org (www.cpan.org)|151.101.54.49|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 88236 (86K) [application/x-gzip]
Saving to: ‘HTML-Template-2.97.tar.gz’

HTML-Template-2.97. 100%[===================>]  86.17K  --.-KB/s    in 0.09s   

2018-02-02 18:26:12 (913 KB/s) - ‘HTML-Template-2.97.tar.gz’ saved [88236/88236]


Extract the source code from the tarball:

[jamie@dell-1640 SRC]$ ls -alh
total 100K
drwxrwxr-x. 2 jamie jamie 4.0K Feb  2 18:26 .
drwxrwxr-x. 3 jamie jamie 4.0K Feb  2 17:23 ..
-rw-rw-r--. 1 jamie jamie  87K May 18  2017 HTML-Template-2.97.tar.gz
[jamie@dell-1640 SRC]$ tar -xvzf HTML-Template-2.97.tar.gz
HTML-Template-2.97/
HTML-Template-2.97/t/
HTML-Template-2.97/t/12-utf8.t
HTML-Template-2.97/t/01-coderefs.t
HTML-Template-2.97/t/04-no_taintmode.t
HTML-Template-2.97/t/13-loop-context.t
HTML-Template-2.97/t/13-loop-boolean.t
HTML-Template-2.97/t/02-random.t
HTML-Template-2.97/t/03-associate.t
HTML-Template-2.97/t/05-force_untaint.t
HTML-Template-2.97/t/02-parse.t
HTML-Template-2.97/t/04-escape.t
HTML-Template-2.97/t/11-non-file-templates.t
HTML-Template-2.97/t/testlib/
HTML-Template-2.97/t/testlib/IO/
HTML-Template-2.97/t/testlib/IO/Capture.pm
HTML-Template-2.97/t/testlib/IO/Capture/
HTML-Template-2.97/t/testlib/IO/Capture/ErrorMessages.pm
HTML-Template-2.97/t/testlib/IO/Capture/Tie_STDx.pm
HTML-Template-2.97/t/testlib/IO/Capture/Stderr.pm
HTML-Template-2.97/t/testlib/IO/Capture/Stdout.pm
HTML-Template-2.97/t/testlib/_Auxiliary.pm
HTML-Template-2.97/t/08-cache-debug.t
HTML-Template-2.97/t/16-config.t
HTML-Template-2.97/t/07-double-file-cache.t
HTML-Template-2.97/t/12-query.t
HTML-Template-2.97/t/15-comment.t
HTML-Template-2.97/t/06-file-cache-dir.t
HTML-Template-2.97/t/04-type-source.t
HTML-Template-2.97/t/10-param.t
HTML-Template-2.97/t/03-else_else_bug.t
HTML-Template-2.97/t/01-bad-args.t
HTML-Template-2.97/t/05-nested_global.t
HTML-Template-2.97/t/12-open_mode.t
HTML-Template-2.97/t/05-blind-cache.t
HTML-Template-2.97/t/04-default_with_escape.t
HTML-Template-2.97/t/14-includes.t
HTML-Template-2.97/t/author-pod-syntax.t
HTML-Template-2.97/t/99-old-test-pl.t
HTML-Template-2.97/t/04-default-escape.t
HTML-Template-2.97/t/13-loop-repeated.t
HTML-Template-2.97/t/09-caching-precluded.t
HTML-Template-2.97/Makefile.PL
HTML-Template-2.97/META.yml
HTML-Template-2.97/dist.ini
HTML-Template-2.97/LICENSE
HTML-Template-2.97/lib/
HTML-Template-2.97/lib/HTML/
HTML-Template-2.97/lib/HTML/Template.pm
HTML-Template-2.97/lib/HTML/Template/
HTML-Template-2.97/lib/HTML/Template/FAQ.pm
HTML-Template-2.97/bench/
HTML-Template-2.97/bench/profile_small.pl
HTML-Template-2.97/bench/profile_var.pl
HTML-Template-2.97/bench/vars.pl
HTML-Template-2.97/bench/profile_medium.pl
HTML-Template-2.97/bench/new.pl
HTML-Template-2.97/bench/profile_large.pl
HTML-Template-2.97/README
HTML-Template-2.97/scripts/
HTML-Template-2.97/scripts/clean_shm.pl
HTML-Template-2.97/scripts/time_trial.pl
HTML-Template-2.97/MANIFEST
HTML-Template-2.97/templates/
HTML-Template-2.97/templates/case_loop.tmpl
HTML-Template-2.97/templates/include_path2/
HTML-Template-2.97/templates/include_path2/inner.tmpl
HTML-Template-2.97/templates/ifelse.tmpl
HTML-Template-2.97/templates/searchpath/
HTML-Template-2.97/templates/searchpath/included.tmpl
HTML-Template-2.97/templates/searchpath/three.tmpl
HTML-Template-2.97/templates/searchpath/two.tmpl
HTML-Template-2.97/templates/double_loop.tmpl
HTML-Template-2.97/templates/js.tmpl
HTML-Template-2.97/templates/escapes.tmpl
HTML-Template-2.97/templates/simple-loop-nonames.tmpl
HTML-Template-2.97/templates/simple.tmpl
HTML-Template-2.97/templates/include_path/
HTML-Template-2.97/templates/include_path/a.tmpl
HTML-Template-2.97/templates/include_path/one.tmpl
HTML-Template-2.97/templates/include_path/inner.tmpl
HTML-Template-2.97/templates/include_path/b.tmpl
HTML-Template-2.97/templates/included3.tmpl
HTML-Template-2.97/templates/context.tmpl
HTML-Template-2.97/templates/default_escape.tmpl
HTML-Template-2.97/templates/loop-context.tmpl
HTML-Template-2.97/templates/vanguard2.tmpl
HTML-Template-2.97/templates/included.tmpl
HTML-Template-2.97/templates/html-escape.tmpl
HTML-Template-2.97/templates/default.tmpl
HTML-Template-2.97/templates/loop.tmpl
HTML-Template-2.97/templates/multiline_tags.tmpl
HTML-Template-2.97/templates/utf8-test.tmpl
HTML-Template-2.97/templates/recursive.tmpl
HTML-Template-2.97/templates/var.tmpl
HTML-Template-2.97/templates/loop-if.tmpl
HTML-Template-2.97/templates/included2.tmpl
HTML-Template-2.97/templates/urlescape.tmpl
HTML-Template-2.97/templates/medium.tmpl
HTML-Template-2.97/templates/simple-loop.tmpl
HTML-Template-2.97/templates/if.tmpl
HTML-Template-2.97/templates/counter.tmpl
HTML-Template-2.97/templates/newline_test1.tmpl
HTML-Template-2.97/templates/query-test.tmpl
HTML-Template-2.97/templates/globals.tmpl
HTML-Template-2.97/templates/long_loops.tmpl
HTML-Template-2.97/templates/simplemod.tmpl
HTML-Template-2.97/templates/default_escape_off.tmpl
HTML-Template-2.97/templates/global-loops.tmpl
HTML-Template-2.97/templates/unless.tmpl
HTML-Template-2.97/templates/query-test2.tmpl
HTML-Template-2.97/templates/outer.tmpl
HTML-Template-2.97/templates/newline_test2.tmpl
HTML-Template-2.97/templates/other-loop.tmpl
HTML-Template-2.97/templates/include.tmpl
HTML-Template-2.97/templates/vanguard1.tmpl
HTML-Template-2.97/Changes