1. Perl
  2. here

Perl module thorough explanation

A description of Perl modules. A module in Perl is a mechanism for using frequently used functions and convenient functions in a program.

Once you've learned the basic Perl grammar, try using different modules. By combining modules, you can easily solve complex problems and help automate operations.

Also, on the module distribution site called CPAN, many useful modules are registered by volunteers and can be used free of charge. See CPAN Module Description for how to use the cpan command.

How to create a module

If you want to know the basic knowledge for creating modules such as "packages", please refer to "Module basics". If you want to actually create a module yourself, it is a quick way to create a module template using Module::Starter module.

Module existence check

If you want to know if a particular module exists, the quickest way is to check for documentation with the perldoc command.

# perldoc command
perldoc Mojolicious

If you want to know where the module is installed, use the "-l" option. The path is displayed.

perldoc -l Mojolicious

If you want to know the module version, it is best to actually look at the module file using the "-m" option.

perldoc -m Mojolicious

Look for the package variable for which the version is specified.

our $VERSION = '7.25';

Module loading path

Please refer to the following for how to add the module loading path.

Standard module

A "standard module" is a module that is available from the beginning when you install Perl. There are quite a lot of things that can be done with just the "standard module".

Module name Explanation
strict Make grammar strict
warnings Output a warning
Getopt::Long Handle command line argument options
Archive::Tar Extract and create tar file (v5.10 or later)
Cwd Get the path of the current directory
File::Basename Get the base name and directory name of the file
File::Copy Move and copy files
File::Path Creating and deleting multi-level directories
File::Spec Portable processing for filenames
File::Temp Creating a temporary file
File::Find File search
FindBin Get the path of the directory where the script resides
Encode Properly handle multi-byte strings such as Japanese
utf8 Convert strings in source code to decoded strings
Carp Raise an exception from the perspective of the module caller
lib Add module search path
Time::Piece Standard module for handling date/time(core module from v5.10)
Time::Local Reverse return of localtime and gmtime
base Class inheritance
Data::Dumper Output the contents of the variable
Benchmark Benchmark (performance comparison)
JSON Parsing JSON data
MIME::Base64 Encoding to Base64 format
MIME::QuotedPrint Encoding to quoted-printable format
Digest::MD5 Find the MD5 value
Digest::SHA Find various SHA values (v5.10 or later)
Storable Data serialization
Scalar::Util Utility for scalar values
List::Util Various operations on arrays
Hash::Uti Hash key restrictions
Sys::Hostname Get host name
Net::FTP FTP client
Net::Ping Confirmation of the existence of the remote host
Exporter Function export
CPAN Install modules from CPAN
Pod::Usage Output of POD document
Errno A constant that represents the system error number
POSIX Functions defined in POSIX
Math::BigInt
Math::BigFloat
Calculation of large numbers
Class::Struct Core module that provides object orientation

CPAN module commentary

Perl makes it easy to install and use free modules from CPAN.

Web development

Mojolicious Web framework
Mojolicious::Plugin::AutoRoute Automatically generate troublesome routes
Amazon::S3::Thin Thin, lightweight, low-level Amazon S3 client

Send email

MIME::Lite Send email easily

Development environment

perlbrew Install Perl in your environment
cpanm CPAN installation

Object-oriented

Class::Accessor::Fast Creating accessors
Object::Simple Creating accessors with default values (Japanese translation)

Utility

DDP Output data in an easy-to-understand way
D Encode data and dump to standard error

Database

DBIx::Custom Easy database operation
MySQL::Diff View MySQL diffs

date

DateTime General-purpose processing of dates

Statistical analysis

PDL Statistical analysis

Image editing

Imager edit a picture

CSV

Text::CSV::Encoded Handles CSV files containing Japanese

Text diff

Text::Diff Check text differences

XML

XML::Simple Simple XML parser

HTML validation

Validator::Custom HTML form validation

Paging

Data::Page Support for paging processing
Data::Page::Navigation Creating page navigation

Module creation

Module::Starter Create a module template

Performance analysis

Devel::NYTProf Easy-to-use profiler

Source code formatting

perltidy Source code formatting

ping

Net::Ping::External Executing the ping command

Exam

IO::ScalarArray Automatic test of standard input
IO::Capture Automatic test of standard output and standard error output

FFI

FFI::Raw Call a function in a dynamic library

Trigonometric functions

Math::Trig Various trigonometric functions

Web scraping

Selenium::Remote::Driver JavaScript-enabled web scraping
Selenium::Chrome JavaScript-enabled web scraping using Chome

Perl module introduction

Please see below for the modules that could not be explained in detail here.

Deprecated modules

Deprecated module.

Module name Explanation
cgi-lib.pl It's very old. Use CGI.pm instead
Devel::DProf It is a simple profiler (performance analysis tool), but it has many bugs, so it will be removed from the core module.
encoding Officially deprecated. Save the source code in UTF-8 and use the utf8 pragma
jcode.pl It's very old. Use the Encode module to work with strings
Jcode Officially deprecated. Use the Encode module to work with strings
bytes Officially deprecated. Actually encode with the encode function of the Encode module and then check the length
vars old. It has the same effect as declaring a package variable in our. Now let's declare the package variable using our
Class::ISA Officially deprecated. Removed from core module

Related Informatrion