App-perlimports

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "Test::Portability::Files" : "0",
            "Test::Spelling" : "0.17",
            "Test::Vars" : "0.014",
            "Test::Version" : "1"
         }
      },
      "runtime" : {
         "requires" : {
            "Capture::Tiny" : "0",
            "Class::Inspector" : "1.36",
            "Cpanel::JSON::XS" : "0",
            "Data::Dumper" : "0",
            "Data::UUID" : "0",
            "File::Basename" : "0",
            "File::XDG" : "1.01",
            "Getopt::Long::Descriptive" : "0",
            "List::Util" : "0",
            "Log::Dispatch" : "2.70",
            "Memoize" : "0",
            "Module::Runtime" : "0",
            "Moo" : "0",

META.json  view on Meta::CPAN

      "James Raspass <jraspass@gmail.com>",
      "Jos\u00e9 Manuel Rodri\u0301guez D <jose93rd@gmail.com>",
      "Kenichi Ishigaki <ishigaki@cpan.org>",
      "Nelo Onyiah <nelo.onyiah@gmail.com>",
      "Nicolas Mendoza <mendoza@pvv.ntnu.no>",
      "Olaf Alders <olaf.alders@gmail.com>",
      "Olaf Alders <olaf@wundersolutions.com>",
      "Peter Oliver <git@mavit.org.uk>"
   ],
   "x_generated_by_perl" : "v5.40.0",
   "x_serialization_backend" : "Cpanel::JSON::XS version 4.39",
   "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later",
   "x_static_install" : 1
}

META.yml  view on Meta::CPAN

name: App-perlimports
no_index:
  directory:
    - examples
    - t
    - test-data
    - xt
requires:
  Capture::Tiny: '0'
  Class::Inspector: '1.36'
  Cpanel::JSON::XS: '0'
  Data::Dumper: '0'
  Data::UUID: '0'
  File::Basename: '0'
  File::XDG: '1.01'
  Getopt::Long::Descriptive: '0'
  List::Util: '0'
  Log::Dispatch: '2.70'
  Memoize: '0'
  Module::Runtime: '0'
  Moo: '0'

Makefile.PL  view on Meta::CPAN

  "EXE_FILES" => [
    "script/dump-perl-exports",
    "script/perlimports"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.018000",
  "NAME" => "App::perlimports",
  "PREREQ_PM" => {
    "Capture::Tiny" => 0,
    "Class::Inspector" => "1.36",
    "Cpanel::JSON::XS" => 0,
    "Data::Dumper" => 0,
    "Data::UUID" => 0,
    "File::Basename" => 0,
    "File::XDG" => "1.01",
    "Getopt::Long::Descriptive" => 0,
    "List::Util" => 0,
    "Log::Dispatch" => "2.70",
    "Memoize" => 0,
    "Module::Runtime" => 0,
    "Moo" => 0,

Makefile.PL  view on Meta::CPAN

  "VERSION" => "0.000057",
  "test" => {
    "TESTS" => "t/*.t t/ExportInspector/*.t t/cpan-modules/*.t"
  }
);


my %FallbackPrereqs = (
  "Capture::Tiny" => 0,
  "Class::Inspector" => "1.36",
  "Cpanel::JSON::XS" => 0,
  "Data::Dumper" => 0,
  "Data::UUID" => 0,
  "ExtUtils::MakeMaker" => 0,
  "File::Basename" => 0,
  "File::Spec" => 0,
  "File::XDG" => "1.01",
  "File::pushd" => 0,
  "Getopt::Long::Descriptive" => 0,
  "List::Util" => 0,
  "Log::Dispatch" => "2.70",

cpanfile  view on Meta::CPAN

# This file is generated by Dist::Zilla::Plugin::CPANFile v6.032
# Do not edit this file directly. To change prereqs, edit the `dist.ini` file.

requires "Capture::Tiny" => "0";
requires "Class::Inspector" => "1.36";
requires "Cpanel::JSON::XS" => "0";
requires "Data::Dumper" => "0";
requires "Data::UUID" => "0";
requires "File::Basename" => "0";
requires "File::XDG" => "1.01";
requires "Getopt::Long::Descriptive" => "0";
requires "List::Util" => "0";
requires "Log::Dispatch" => "2.70";
requires "Memoize" => "0";
requires "Module::Runtime" => "0";
requires "Moo" => "0";

lib/App/perlimports/Document.pm  view on Meta::CPAN


has json => (
    is      => 'ro',
    isa     => Bool,
    lazy    => 1,
    default => 0,
);

has _json_encoder => (
    is      => 'ro',
    isa     => InstanceOf ['Cpanel::JSON::XS'],
    lazy    => 1,
    default => sub {
        require Cpanel::JSON::XS;
        return Cpanel::JSON::XS->new;
    },
);

has lint => (
    is      => 'ro',
    isa     => Bool,
    lazy    => 1,
    default => 0,
);

script/perlimports  view on Meta::CPAN

your deployment process.

C<perlimports> can remove unused modules for you, making dependency management
much easier.

=item Enforcing a consistent style

Having a messy list of module imports makes your code harder to read. Imagine
this:

    use Cpanel::JSON::XS;
    use Database::Migrator::Types qw( HashRef ArrayRef Object Str Bool Maybe CodeRef FileHandle RegexpRef );
    use List::AllUtils qw( uniq any );
    use LWP::UserAgent    q{};
    use Try::Tiny qw/ catch     try /;
    use WWW::Mechanize  q<>;

L<perlimports> turns the above list into:

    use Cpanel::JSON::XS ();
    use Database::Migrator::Types qw(
        ArrayRef
        Bool
        CodeRef
        FileHandle
        HashRef
        Maybe
        Object
        RegexpRef
        Str

script/perlimports  view on Meta::CPAN


Aside from the documented command line switches for ignoring modules, you can
add annotations in your code.

    use Encode; ## no perlimports

The above will tell L<perlimports> not to attempt a tidy of this line.

    ## no perlimports
    use Encode;
    use Cpanel::JSON::XS;
    ## use perlimports

    use POSIX ();

The above will tell L<perlimports> not to tidy the two modules contained inside
of the annotations.

Please note that since L<perlimports> needs to know as much as possible about
what's going on in a file, the annotations don't prevent modules from being
loaded. It's only a directive to leave the lines in the file unchanged after

t/00-report-prereqs.dd  view on Meta::CPAN

                                      'Test::Portability::Files' => '0',
                                      'Test::Spelling' => '0.17',
                                      'Test::Vars' => '0.014',
                                      'Test::Version' => '1'
                                    }
                    },
       'runtime' => {
                      'requires' => {
                                      'Capture::Tiny' => '0',
                                      'Class::Inspector' => '1.36',
                                      'Cpanel::JSON::XS' => '0',
                                      'Data::Dumper' => '0',
                                      'Data::UUID' => '0',
                                      'File::Basename' => '0',
                                      'File::XDG' => '1.01',
                                      'Getopt::Long::Descriptive' => '0',
                                      'List::Util' => '0',
                                      'Log::Dispatch' => '2.70',
                                      'Memoize' => '0',
                                      'Module::Runtime' => '0',
                                      'Moo' => '0',

t/cli.t  view on Meta::CPAN

#!perl

use strict;
use warnings;

use lib 'test-data/lib', 't/lib';

use App::perlimports::CLI ();
use Capture::Tiny         qw( capture );
use Cpanel::JSON::XS      qw( decode_json );
use File::pushd           qw( pushd );
use Path::Tiny            ();
use TestHelper            qw( logger );
use Test::Differences     qw( eq_or_diff );
use Test::Fatal           qw( exception );
use Test::More import => [qw( done_testing is like ok subtest )];
use Test::Needs qw( Perl::Critic::Utils );

subtest 'bad path to config file' => sub {
    local @ARGV = (

t/never-exports.t  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;

use lib 't/lib';

use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is is_deeply ok subtest )];
use Test::Needs {
    'Cpanel::JSON::XS' => 4.19,
    'Getopt::Long'     => 2.40,
    'LWP::UserAgent'   => 5.00,
    'Test::Script'     => 1.27,
};

subtest 'with version' => sub {
    my $pi = source2pi(
        'test-data/with-version.pl',
        'use LWP::UserAgent 5.00;',
    );

t/with-version.t  view on Meta::CPAN

use strict;
use warnings;

use lib 't/lib';

use Test::Differences qw( eq_or_diff );
use TestHelper        qw( doc );
use Test::More import => [qw( diag done_testing )];
use Test::Needs {
    'Cpanel::JSON::XS' => 4.19,
    'Getopt::Long'     => 2.40,
    'LWP::UserAgent'   => 5.00,
};

my ( $doc, $log ) = doc( filename => 'test-data/with-version.pl' );

my $expected = <<'EOF';
use strict;
use warnings;

use Cpanel::JSON::XS 4.19 qw( decode_json );
use Getopt::Long 2.40 qw( GetOptions );
use LWP::UserAgent 5.00 ();
use Test::Script 1.27 qw(
    script_compiles
    script_runs
    script_stderr_is
    script_stderr_like
);

my $foo = decode_json( { foo => 'bar' } );

test-data/with-version.pl  view on Meta::CPAN

use strict;
use warnings;

use Cpanel::JSON::XS 4.19 qw( encode_json );
use Getopt::Long 2.40 qw();
use LWP::UserAgent 5.00;
use Test::Script 1.27 qw(
    script_compiles
    script_runs
    script_stderr_is
    script_stderr_like
);

my $foo = decode_json( { foo => 'bar' } );

test-needs-cpanfile  view on Meta::CPAN

use strict;
use warnings;

on 'test' => sub {
    requires 'Cpanel::JSON::XS' => '4.19';
    requires 'DateTime' => 0;
    requires 'File::chdir' => 0;
    requires 'File::Spec::Functions' => 0;
    requires 'Geo::IP' => 0;
    requires 'Getopt::Long' => '2.40';
    requires 'HTML::TableExtract' => 0;
    requires 'Import::Into' => 0;
    requires 'IP::Random' => '1.200230' if "$]" >= 5.020;
    requires 'Lingua::EN::Inflect';
    requires 'List::AllUtils' => 0;



( run in 1.022 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )