App-perlimports
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/perlimports/Document.pm view on Meta::CPAN
has _sub_names => (
is => 'ro',
isa => HashRef,
handles_via => 'Hash',
handles => {
is_sub_name => 'exists',
},
lazy => 1,
builder => '_build_sub_names',
);
has _tidy_whitespace => (
is => 'ro',
isa => Bool,
init_arg => 'tidy_whitespace',
lazy => 1,
default => sub { 1 },
);
has _verbose => (
is => 'ro',
isa => Bool,
init_arg => 'verbose',
default => sub { 0 },
);
around BUILDARGS => sub {
my ( $orig, $class, @args ) = @_;
my %args = @args;
if ( my $modules = delete $args{ignore_modules} ) {
my %modules = map { $_ => 1 } @{$modules};
$args{ignore_modules} = \%modules;
}
if ( my $selection = delete $args{selection} ) {
$args{ppi_selection} = PPI::Document->new( \$selection );
}
return $class->$orig(%args);
};
my %default_ignore = (
'Carp::Always' => 1,
'Constant::Generate' => 1,
'Data::Printer' => 1,
'DDP' => 1,
'Devel::Confess' => 1,
'Encode::Guess' => 1,
'Env' => 1, # see t/env.t
'Exception::Class' => 1,
'Exporter' => 1,
'Exporter::Lite' => 1,
'Feature::Compat::Try' => 1,
'Filter::Simple' => 1,
'Git::Sub' => 1,
'HTTP::Message::PSGI' => 1, # HTTP::Request::(to|from)_psgi
'Import::Into' => 1,
'MLDBM' => 1,
'Modern::Perl' => 1,
'Mojo::Base' => 1,
'Mojo::Date' => 1,
'Mojolicious::Lite' => 1,
'Moo' => 1,
'Moo::Role' => 1,
'Moose' => 1,
'Moose::Exporter' => 1,
'Moose::Role' => 1,
'MooseX::NonMoose' => 1,
'MooseX::Role::Parameterized' => 1,
'MooseX::SemiAffordanceAccessor' => 1,
'MooseX::StrictConstructor' => 1,
'MooseX::TraitFor::Meta::Class::BetterAnonClassNames' => 1,
'MooseX::Types' => 1,
'MooX::StrictConstructor' => 1,
'namespace::autoclean' => 1,
'PerlIO::gzip' => 1,
'Regexp::Common' => 1,
'Sort::ByExample' => 1,
'Struct::Dumb' => 1,
'Sub::Exporter' => 1,
'Sub::Exporter::Progressive' => 1,
'Sub::HandlesVia' => 1,
'Syntax::Keyword::Try' => 1,
'Term::Size::Any' => 1,
'Test2::Util::HashBase' => 1,
'Test::Exception' => 1,
'Test::Needs' => 1,
'Test::Number::Delta' => 1,
'Test::Pod' => 1,
'Test::Pod::Coverage' => 1,
'Test::Requires::Git' => 1,
'Test::RequiresInternet' => 1,
'Test::Warnings' => 1,
'Test::Whitespaces' => 1,
'Test::XML' => 1,
'Types::Standard' => 1,
'URI::QueryParam' => 1,
);
# Funky stuff could happen with inner packages.
sub _build_my_own_inspector {
my $self = shift;
my $pkgs
= $self->ppi_document->find(
sub { $_[1]->isa('PPI::Statement::Package') && $_[1]->file_scoped } );
if ( !$pkgs || $pkgs->[0]->namespace eq 'main' ) {
return;
}
my $pkg = $pkgs->[0];
# file_scoped() doesn't seem to be very reliable, so let's just try a crude
# check to see if this is a package we might actually find on disk before
# we try to require it.
my $notional_file
= fileparse( module_notional_filename( $pkg->namespace ) );
my $provided_file = fileparse( $self->_filename );
return unless $notional_file eq $provided_file;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.706 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )