peril.pm

I use Perl on a regular basis for all sorts of little scripts and automation tasks. peril.pm is a Perl module where I collect a bunch of subroutines which come up time and again in the scripts I write. The name is due to Julian Brown. It's really only intended for my use, but it might grow into something that other people might find useful. I keep it here so I can easily download it to whatever computer I am using from the URL https://www.rawles.net/peril/peril.pm. As time goes on, I'll migrate handy subroutines into the module and update this page.

Documentation (such that it is)

Everything is untidily lumped into the same module for now. To use it, add the following at the top of your script:

use peril;

Logging

As the minimal step up from print-statements where any sensible person would use a debugger, I have three loglevels, shout (for major phases in a program's execution), say (for minor updates about a program's progess), think (the equivalent of debug statements). Major errors are just handled with the built-in die function for now.

The message is output with the current time. Newlines are not needed in the message.

shout "Welcome to peril.";
say "Writing checkpoint file ${checkpointname}.";
think "Response code was ${responsecode}.";