Perl CLI: Subcommands With Getopt::Long

Recently, I’ve been working on a CLI tool for Webmin (cleverly called webmin, to match the existing virtualmin and cloudmin CLI tools) that supports sub-commands. This is an extremely common user interface concept, and most developers have probably used one (git being an extremely popular example). But, in a cursory googling it wasn’t obvious how to do it with Perl using only core modules. There are several CPAN modules that’ll do it, including GetOpt::Long::Subcommand and App::Cmd, and they both look good for their intended audience, but I didn’t want to pull in any extra dependencies and I had somewhat different requirements that made it simpler to just use GetOpt::Long (which has been a core Perl module for many years). [Read More]

Troubleshooting BIND

We recently had an issue on a customer’s system where DNS wasn’t responding. In this case, the problem ended up being in “the last place I looked for it”, I thought I’d scribble down my thought process when troubleshooting BIND. This process looks similar for most network services, but I’ll be using BIND for this example. In this case, the user gave us literally no information to go on, other than “BIND isn’t working, there must be a bug in Webmin. [Read More]

Unit Testing and Travis CI For Bash Or POSIX Shell

Recently I’ve been working on getting some of our projects working with Travis CI, so that we’ll know about regressions in our code. Our software is a a diverse collection of Perl, JavaScript, a tiny bit of Python and C, and an uncomfortably large amount of POSIX shell code. Things are easy for Perl, the language of choice for most of Virtualmin and Webmin: It is easy to test, has great modules, a great test runner, and great tools for parsing and presenting the output. [Read More]

The Trickiest Thing About Perl (for beginners)

I was recently talking with our awesome UI/UX designer, Ilia, about a problem he was having with Perl. He mostly develops in JavaScript and web technologies, but his front-end obviously has to interact sometimes with the Perl in Webmin. And, sometimes he has to write some Perl, which is not an area he has had any experience with before working with us. Perl can be a tricky language for beginners to the language because of a few quirks that make it behave in seemingly bizarre ways. [Read More]