Basic Perl Utility Modules?

I am currently cleaning up the old Perl project. Most of it was written by me some time ago, when I barely knew Perl. I probably invented the wheel several times.

Now I want to throw away any duplicated code and, if possible, replace everything that is already available in high-quality CPAN modules.

What essential Perl utility modules do you know about what every Perl developer should know?

This question is similar to the Perl Useful Modules question, but I do not agree that large modules are listed there (e.g. DBI, Template, et al.).

+4
source share
3 answers

I use these a lot:

Path :: Class for manipulating directories and file paths

Class :: Download (to load classes at runtime)

Try :: Tiny (for simple and proper exception handling)

FindBin :: libs etc.,

Email :: Valid for verification email address

also, Regexp :: Common for common regular expressions.

+2
source

I regularly use ::Util modules (including List :: MoreUtils , which is not the kernel). Especially the reduce and first functions from List :: Util .

Another thing that I use constantly is File :: chdir . It provides access to the working directory through related variables. This allows you to localize changes in the working directory to each block. I like its interface so much that I even wrote Tie :: Select , which provides a similar interface to the select function.

tjmc correctly offers Try :: Tiny , which reminds me of Capture :: Tiny . This module displays the output of almost everyone, including Perl commands, system calls, and XS modules.

+1
source

Perl :: Tidy and Perl :: Critic, and not for the modules themselves, but for two scripts, perltidy and perlcritic. With these two, solving a large project is much, much simpler.

0
source

Source: https://habr.com/ru/post/1402094/


All Articles