wiki:Features/ProjectSkeletonGeneration

Version 17 (modified by bowtie, 2 years ago) (diff)

--

Skeleton Generation

Module::Starter

As a first step in the direction of supporting CPAN-style Perl projects we integrated into Padre the use of Module::Starter, The intent is to make it as easy as possible for CPAN authors (and especially for first-time CPAN authors) to have installers that follow all the best practices for distribution installation, but involve as much DWIM (Do What I Mean) as possible when writing them.
The "bones" of every new module are basically the same: even if it's not your intention to distribute, you should still Build, new module frameworks automatically. PBP

  • The original, oldest module for installing modules is ExtUtils::MakeMaker.
    • the daddy, old, use one of the other's
  • Module::Build is pure-perl. This means it does not require a make program to be installed for you to build/install modules. In fact, you don't even need a shell, so even platforms like MacOS (traditional) can use it fairly easily. This is not a problem with recent versions of perl because Module::Build is a core module.
    • pure-perl :)
  • Module::Install is a package for writing installers for CPAN (or CPAN-like) distributions that are clean, simple, minimalist, act in a strictly correct manner with ExtUtils::MakeMaker, Another very unique feature is auto-install. When the module author enables auto-install for his distribution, Module::Install will search for and install any pre-requisite modules that are not installed when Makefile.PL is executed.
    • used by Catalyst

module-starter will look for a configuration file before reading its command line parameters. The default location is $HOME/.module-starter/config but if the MODULE_STARTER_DIR environment variable is set, module-starter will look for config in that directory.

File -> New -> Perl Distribution

Will bring up a dialog box where you can select some of the parameters your new project.

image of File -> New -> Perl Distribution

  • Perl 5 Script: generates a *.pl file
  • Perl 5 Module: generates a *.pm file
  • Perl 5 Test: generates a *.t file
  • Perl 6 Script: genertes a *.pl file

NB. from Padre/share/templates/

Perl Distribution

image of new Perl Distribution setup

  • Module Name: <your module name>
    • note first letter should be Capitalised and :: (package identifiers) supported.
      • You can now add multiple module names, ie: Foo::Bar, Foo::Bar::Two (csv)
  • Author: <your name>
    • note this will ignore author: in ~/.moule-starter/config
  • Email Address: <your e-mail address>
    • note this will ignore email: in ~/.moule-starter/config
  • Builder: select an Option
    • note you can change the default Option, Tools => Preferences => Advanced => builder

list of builder options

  • License: select n Option
    • note you can change the default Option, Tools => Preferences => Advanced => license

list of license options

  • Parent Directory: <the dir you wish to build your skeleton in>

Once you click OK, Module::Starter will create a new directory in the parent directory you selected.

Tree view of Skeleton (Vanilla) Build

Mail-Check/
├── Changes
├── ignore.txt
├── lib
│   └── Mail
│       └── Check.pm
├── Makefile.PL
├── MANIFEST
├── README
└── t
    ├── 00.load.t
    ├── perlcritic.t
    ├── pod-coverage.t
    └── pod.t

To Do Next

  • Load appropriate *.Pl and Run => Run Script
SkeletonAction
Module::Buildperl Build.PL
Module::Installperl Makfile.PL
ExtUtils::MakeMakerperl Makefile.PL

Tickets

Ticket Resolution Summary Owner Reporter
#1324 fixed One of our features is missing... Skelton Build or Module::Starter adamk bowtie

Test

Perl distributions and templates and running

  1. create a new Perl 5 distribution: "File" -> "New" -> "Perl Distribution ..."
  2. create an additional "hello, world" style Perl 5 module in the same namespace: "File" -> "New" -> "Perl 5 Module"
  3. use "File" -> "Save Intuition" to save the module
  4. create a test for the module: "File" -> "New" -> "Perl 5 Test"
  5. run the test: "Run" -> "Run Tests"
  6. run the test: "Run" -> "Run and Build Tests"
  7. create a new Perl 5 script that uses the module: "File" -> "New" -> "Perl 5 Script"
  8. run it: "Run" -> "Run Script"
  9. run it: "Run" -> "Run Script (Debug Info)"
  10. add an infinite loop the the script
  11. run the script and abort it using F6

Attachments (5)

Download all attachments as: .zip