PERL Info
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 can be preferable to manually install a Perl module from source code after downloading and compiling. Here are the basic instructions to do it yourself manually from the command line. 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 as "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 app may be.
All of these examples are intended to be run from a command line, 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:
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]
List directory contents to confirm tarball file is there. The -l switch tells the list command(ls) to give the listing in "long" format, which shows among other things, the size and creation dates of the files. The -h switch causes the "long" listing format to be in "human" readable format:
[jamie@dell-1640 SRC]$ ls -lh total 92K -rw-rw-r--. 1 jamie jamie 87K May 18 2017 HTML-Template-2.97.tar.gz [jamie@dell-1640 SRC]$
Extract the source code from the tarball:
[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 [jamie@dell-1640 SRC]$
Do a long human-readable listing to confirm the extraction of the tarball worked successfully:
[jamie@dell-1640 HTML-Template-2.97]$ ls -lh total 76K drwxrwxr-x. 2 jamie jamie 4.0K May 18 2017 bench -rw-r--r--. 1 jamie jamie 16K May 18 2017 Changes -rw-r--r--. 1 jamie jamie 745 May 18 2017 dist.ini drwxrwxr-x. 3 jamie jamie 4.0K May 18 2017 lib -rw-r--r--. 1 jamie jamie 18K May 18 2017 LICENSE -rw-r--r--. 1 jamie jamie 1.3K May 18 2017 Makefile.PL -rw-r--r--. 1 jamie jamie 2.4K May 18 2017 MANIFEST -rw-r--r--. 1 jamie jamie 714 May 18 2017 META.yml -rw-r--r--. 1 jamie jamie 387 May 18 2017 README drwxrwxr-x. 2 jamie jamie 4.0K May 18 2017 scripts drwxrwxr-x. 3 jamie jamie 4.0K May 18 2017 t drwxrwxr-x. 5 jamie jamie 4.0K May 18 2017 templates [jamie@dell-1640 HTML-Template-2.97]$
Configure the Makefile.PL file prior to compiling/building:
[jamie@dell-1640 HTML-Template-2.97]$ perl Makefile.PL Checking if your kit is complete... Looks good Warning: prerequisite Test::Pod 0 not found. Generating a Unix-style Makefile Writing Makefile for HTML::Template Writing MYMETA.yml and MYMETA.json [jamie@dell-1640 HTML-Template-2.97]$
Install any missing prerequisite(s). In our example above, the configuration of the Makefile.PL file resulted in an error stating that the prerequisite "Test::Pod" wasn't found so not installed. The configuration appeared to complete, but needs to be run again after first satisfying the prerequisite.
Install the "Test::Pod" module before proceeding. Try using the easier and simpler MCPAN command:
[jamie@dell-1640 HTML-Template-2.97]$ perl -MCPAN -e 'install Test::Pod' CPAN.pm requires configuration, but most of it can be done automatically. If you answer 'no' below, you will enter an interactive dialog for each configuration option instead. Would you like to configure as much as possible automatically? [yes] Perl site library directory "/usr/local/share/perl5" does not exist. Perl site library directory "/usr/local/share/perl5" could not been created: Permission denied. Perl site library directory "/usr/local/lib64/perl5" does not exist. Perl site library directory "/usr/local/lib64/perl5" could not been created: Permission denied. <install_help> Warning: You do not have write permission for Perl library directories. To install modules, you need to configure a local Perl library directory or escalate your privileges. CPAN can help you by bootstrapping the local::lib module or by configuring itself to use 'sudo' (if available). You may also resolve this problem manually if you need to customize your setup. What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') [local::lib] sudo Autoconfiguration complete. commit: wrote '/home/jamie/.local/share/.cpan/CPAN/MyConfig.pm' You can re-run configuration any time with 'o conf init' in the CPAN shell Fetching with LWP: http://www.cpan.org/authors/01mailrc.txt.gz Reading '/home/jamie/.local/share/.cpan/sources/authors/01mailrc.txt.gz' ............................................................................DONE Fetching with LWP: http://www.cpan.org/modules/02packages.details.txt.gz Reading '/home/jamie/.local/share/.cpan/sources/modules/02packages.details.txt.gz' Database was generated on Sat, 03 Feb 2018 03:54:43 GMT ............................................................................DONE Fetching with LWP: http://www.cpan.org/modules/03modlist.data.gz Reading '/home/jamie/.local/share/.cpan/sources/modules/03modlist.data.gz' DONE Writing /home/jamie/.local/share/.cpan/Metadata Running install for module 'Test::Pod' Fetching with LWP: http://www.cpan.org/authors/id/E/ET/ETHER/Test-Pod-1.51.tar.gz Fetching with LWP: http://www.cpan.org/authors/id/E/ET/ETHER/CHECKSUMS Checksum for /home/jamie/.local/share/.cpan/sources/authors/id/E/ET/ETHER/Test-Pod-1.51.tar.gz ok 'YAML' not installed, will not store persistent state Configuring E/ET/ETHER/Test-Pod-1.51.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Test::Pod Writing MYMETA.yml and MYMETA.json ETHER/Test-Pod-1.51.tar.gz /usr/bin/perl Makefile.PL -- OK Running make for E/ET/ETHER/Test-Pod-1.51.tar.gz cp lib/Test/Pod.pm blib/lib/Test/Pod.pm Manifying 1 pod document ETHER/Test-Pod-1.51.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-load.t ............ 1/2 # Testing Test::Pod 1.51, Perl 5.026001, /usr/bin/perl # Using Pod::Simple 3.35 t/00-load.t ............ ok t/all_pod_files.t ...... ok t/cut-outside-block.t .. ok t/good.t ............... ok t/item-ordering.t ...... ok t/load.t ............... ok t/missing-file.t ....... ok t/selftest.t ........... ok t/spaced-directives.t .. skipped: Not written yet t/unknown-directive.t .. ok All tests successful. Files=10, Tests=19, 1 wallclock secs ( 0.05 usr 0.01 sys + 0.98 cusr 0.12 csys = 1.16 CPU) Result: PASS ETHER/Test-Pod-1.51.tar.gz /usr/bin/make test -- OK Running make install Manifying 1 pod document Installing /usr/local/share/perl5/Test/Pod.pm Installing /usr/local/share/man/man3/Test::Pod.3pm Appending installation info to /usr/lib64/perl5/perllocal.pod ETHER/Test-Pod-1.51.tar.gz sudo /usr/bin/make install -- OK [jamie@dell-1640 HTML-Template-2.97]$ [root@dell-1640 ~]# dnf install perl-YAML Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: perl-YAML noarch 1.23-4.fc27 fedora 91 k Transaction Summary ================================================================================ Install 1 Package Total download size: 91 k Installed size: 184 k Is this ok [y/N]: y Downloading Packages: perl-YAML-1.23-4.fc27.noarch.rpm 137 kB/s | 91 kB 00:00 -------------------------------------------------------------------------------- Total 99 kB/s | 91 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : perl-YAML-1.23-4.fc27.noarch 1/1 Running scriptlet: perl-YAML-1.23-4.fc27.noarch 1/1 Running as unit: run-r644d8a9c8a2c46fdac64456f20ea700a.service Verifying : perl-YAML-1.23-4.fc27.noarch 1/1 Installed: perl-YAML.noarch 1.23-4.fc27 Complete! [root@dell-1640 ~]# Run perl Makefile.PL again --> 3rd time now! Depending on system, and what is already installed, and what still needs to be installed in order to successfully compile and install the HTML::Template Perl module, it could take more or it could take less attempts and configuring the Makefile.PL pre-compilation configuration file! Here is the output of this command finally completing successfully,the 3rd attempt, on my demonstration system: <pre style="color:blue"> [jamie@dell-1640 HTML-Template-2.97]$ perl Makefile.PL Generating a Unix-style Makefile Writing Makefile for HTML::Template Writing MYMETA.yml and MYMETA.json [jamie@dell-1640 HTML-Template-2.97]$
make make test make install