NAME

Perl::PrereqScanner::NotQuiteLite::App

SYNOPSIS

scan-perl-prereqs-nqlite [options] [DIRS|FILES]

-or-

use Perl::PrereqScanner::NotQuiteLite::App;

my $app = Perl::PrereqScanner::NotQuiteLite::App->new(
  parsers => [qw/:bundled/],
  suggests => 1,
  perl_minimum_version => 1,
);
my $prereqs = $app->run;

DESCRIPTION

Perl::PrereqScanner::NotQuiteLite::App walks down a directory and scans appropriate files to find prerequisites. You usually don't need to touch this module directly, but you might want to if you need finer control (to use a custom CPAN index etc).

METHODS

new

creates an object. Notable options are:

parsers

Perl::PrereqScanner::NotQuiteLite::App uses all the bundled parsers by default, but you can change if you need your own parsers. See Perl::PrereqScanner::NotQuiteLite for details.

recommends, suggests, perl_minimum_version

Perl::PrereqScanner::NotQuiteLite::App usually returns used modules only, but you can change this behavior by setting these options. See Perl::PrereqScanner::NotQuiteLite for details.

develop

If set, Perl::PrereqScanner::NotQuiteLite::App also scans files under xt and author directories to find requirements for development.

exclude_core

If set, Perl::PrereqScanner::NotQuiteLite::App ignores prerequisites that are bundled with Perl (of 5.008001 by default, or of a used perl version if any). This requires Module::CoreList version 2.99 or above.

perl_version

You can explicitly use this option to exclude core modules of a specific perl version.

allow_test_pms

Perl::PrereqScanner::NotQuiteLite::App usually ignores .pm files under t/ directory if they are not used in .t files, considering they are some kind of sample files. However, this assumption may be wrong sometimes. If this option is set, it scans all the .pm files under t/ directory, considering some of the test modules will use them. If Test::Class (or its equivalent) is used in a test file, this option is implicitly set.

base_dir

Perl::PrereqScanner::NotQuiteLite::App usually starts traversing from the current directory. If this option is set, it starts from there.

scan_also

Perl::PrereqScanner::NotQuiteLite::App usually scans .pm files in the base dir, Makefile.PL/Build.PL, files under lib, t, bin, script(s) directories (and xt, author if asked). If your distribution uses a different file layout, or uses extra directories to keep submodules, you can add (a reference to) a list of paths to scan.

ignore, ignore_re

Your distribution may have OS-specific modules whose prerequisites can not be installed in other platforms. You can specify (a reference to) a list of files that should not be scanned (with ignore option), or a regular expression that matches the files (with ignore_re option).

features
my $app = Perl::PrereqScanner::NotQuiteLite::App->new(
  features => {
    'windows' => {
      description => 'Windows support',
      paths => ['lib/Foo/Win32.pm'],
    }
  },
);

Instead of ignoring a set of files, you can use features option to let their prerequisites belong to a specific feature that will not be installed unless asked. However, you are advised to create a separate distribution for the specific feature.

optional, optional_re

Instead of ignoring a set of files, you can also use optional option to mark all the prerequisites found in some of the files in your distribution optional (i.e. suggests). You can specify (a reference to) a list of files (with optional option), or a regular expression that matches the files (with optional_re option).

private, private_re

Your distribution may use private modules that are not uploaded to the CPAN and thus should not be included in cpanfile. You can specify (a reference to) a list of those private modules (with private option) or a regular expression that matches those modules (with private_re option).

use_index, index

Perl::PrereqScanner::NotQuiteLite::App usually lists all the used modules as prerequisites, but some of them may belong to the same distribution. If an instance of CPAN::Common::Index backend is passed, it is used to dedupe those prerequisites (as long as they are not versioned).

use CPAN::Common::Index::LocalPackage;
my $index = CPAN::Common::Index::LocalPackage->new(
  { source => "$ENV{HOME}/minicpan/modules/02packages.details.txt" }
);
my $app = Perl::PrereqScanner::NotQuiteLite::App->new(
  index => $index,
);

run

traverses files and directories and returns a CPAN::Meta::Prereqs object that keeps all the requirements/suggestions, without printing anything unless you explicitly pass a print option to new.

index

returns a CPAN::Common::Index backend object (if any).

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Kenichi Ishigaki.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.