1. Perl
  2. Module
  3. here

Module::Starter - Create a distribution module

If you want to distribute a module, it is convenient to have a module that automatically creates the distribution format. For example, if you want to upload a module you created to CPAN, you must have a defined distribution format. One of the modules that creates the template is Module::Starter .

Create a template with the module - starter command

When you install Module::Starter, the module-starter command is also installed. Create a module using this command. When you execute it, you can confirm that a directory called Somo-Module has been created.

module-starter - module = Some::Module - author = "Yuki Kimoto" - email = kimoto.yuki@gmail.com

Specifying the module name

Specify the module name with -module .

Specify build method

Specify the build method with - builder. You can specify either "ExtUtils::MakeMaker" that uses make, which is the standard build method for Unix-like OS, or "Module::Build" that uses Build written in genuine Perl. By default, "ExtUtils::MakeMaker" is used. Here, "Module::Build" is used.

Unless you have a specific need, it's safe to use ExtUtils::MakeMaker, which is compatible with older versions of Perl.

Your name

Specify your name with - author .

Your email address

Specify your email address with - email .

Directory structure

Immediately after creating the template, the directory structure is as follows.

-rw-r- r-- 1 root root 457 2009-06-14 12:40 Makefile.PL
-rw-r- r-- 1 root root 111 2009-06-14 12:40 Changes
drwxr-xr-x 3 root root 4096 2009-06-14 12:40 lib
-rw-r- r-- 1 root root 89 2009-06-14 12:40 MANIFEST
-rw-r- r-- 1 root root 1398 2009-06-14 12:40 README
drwxr-xr-x 2 root root 4096 2009-06-14 12:40 t

I will briefly explain the roles one by one.

Makefile.PL

Makefile.PL is a script written in Perl for creating a script called Makefile. A script called Makefile is a script for building, testing, and installing modules.

The reason why the script called Makefile is not prepared from the beginning is that the contents of the Makefile script differ depending on the environment such as the difference in OS.

Execute Makefile.PL to create a Makefile script in order to absorb the differences in the environment and perform the process from module construction to installation.

perl Makefile.PL

Will create a script called Makefile.

Changes

Changes is for writing the history when the module is upgraded. Please note that you often forget to write when you upgrade the module.

lib

lib is the directory where the modules are stored. The script that is the main body of the module is stored in this.

MANIFEST

In MANIFEST, describe the file to be stored when the module is distributed. You can edit the MANIFEST file directly, but you can also create it automatically.

t

The directory that stores the module's automated tests.

Related Informatrion