Until Crypt::HSXKPasswd comes out of beta, I’m not going to upload it to CPAN, so until then, the betas need to be manually installed. You can get the latest release of the library by downloading the appropriate .tar.gz file from GitHub.

For Perl regulars, the process is likely to be familiar, because the module is packaged using the very popular Module::Build. The process is quite straight forward, but there are a few potential pitfalls for the uninitiated.

For quick reference, here are the commands needed to install the module:

Before You Begin

The most obvious requirement is a computer with a modern version of Perl installed (version 5.16 or later). OS X comes with Perl pre-installed, Linux distros either have it installed by default, or available via package manager, but Windows users have some work to do in this regard. I don’t have personal experience with Perl on Windows, but it seems that the best advice is to use either Strawberry Perl or Active Perl.

You can check which version of Perl you have installed with the command:

Secondly, OS X and Linux users need to be sure to have dev tools installed before continuing. OS X users have it easy in this regard, you can follow these great instructions from OS X Daily. Linux users, exactly what packages to install will depend on your distribution, but on CentOS/RHEL, yum groupinstall 'Development tools' should do the trick.

If you’re not sure you have the dev tools installed, you do a quick test by verifying that both of the following commands work:

As part of the install process we will be using CPAN to fetch the modules Crypt::HSXKPasswd requires on. If you have never used CPAN before, you’ll have an easier time of the install if you take a moment before getting started to get CPAN up and running. A good way to do this is to use CPAN to install the JSON module, an optional module that enhances Crypt::HSXKPasswd‘s feature set:

If you’ve never used CPAN before, it will try configure itself before going ahead and fetching and installing the JSON module. As a general rule, you can accept the default answer to all the questions, but there is one very important exception to this for OS X users. If you are asked the following question on OS X:

Do not accept the default answer of local::lib, specify sudo instead.

Installing Crypt::HSXKPasswd – Detailed Instructions

Once you have the most recent .tar.gz file downloaded from GitHub, extract it, open a terminal window, and change into the newly extracted folder. You’ll know you’re in the right folder when the command head -5 README gives output something like:

You are now ready to use Module::Build to create a custom installer for the module, tailored to your system:

It is quite likely that this command will result in a warning that one or more required modules, and one or more recommended modules are not installed. This is normal.

If there are missing requirements, the simplest way to install them is to use the custom installer you just created:

You will now be offered a yes/no choice on each of the recommended modules that are not installed on your system. I strongly recommend you say yes to JSON and Math::Random::Secure if you are offered them (you won’t be offered them if they are already installed on your system), and no to the rest.

Once the prerequisites are installed, you can use the custom installer to build the module:

This command will assemble a (hopefully) working copy of the module into a new staging folder called _build.

You can now use the custom installer to test that the staged copy of the module is working on your system (this step is optional):

The final line of the output should be:

Not all the tests specified in the module’s test suite are relevant to installation, so you’ll see some tests get skipped with output something like:

If you’re curious, those other tests come into play when packaging the module, that is to say, converting the original source code into the .tar.gz files that users download.

Assuming the tests pass, you are now ready to install the module:

That’s it – you’re done!

Testing your Installation

Two things should now have been installed – the module itself, and the module’s documentation. You can verify that the documentation is installed with the following command:

When you’ve read as much or as little of the documentation as you like, you can exit out of perldoc with the q key.

You can test that module itself has been properly installed with the perl one-liner, which will generate a password using the WEB32 preset:

Next Steps

Now that you have the module installed, the real fun begins!

You might find this blog post helpful to get you started using the module.

You’ll find full and very detailed documentation here.