PrePAN

Sign in to PrePAN

Import::Base A base module for building base modules

Good

Synopsis

package My::Base;
use base 'Import::Base';
sub modules {
    my ( $class, %args ) = @_;
    return (
        strict => [],
        warnings => [],
    );
}
1;

package My::Module;
use My::Base;

Description

This module makes it easier to build and manage a base set of imports. Rather than importing a dozen modules in each of your project's modules, you simply import one module and get all the other modules you want. This reduces your module boilerplate from 12 lines to 1.

This module also allows further layers of subclassing, so you can build a set of bases like:

  • My::Project::Base
  • My::Project::Class (extends My::Project::Base)
  • My::Project::App (extends My::Project::Class)

Comments

Please sign up to post a review.