App-perlimports

 view release on metacpan or  search on metacpan

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

package App::perlimports::Document;

use Moo;
use utf8;

our $VERSION = '0.000060';

use App::perlimports::Annotations     ();
use App::perlimports::ExportInspector ();
use App::perlimports::Include         ();
use App::perlimports::Sandbox         ();
use File::Basename                    qw( fileparse );
use List::Util                        qw( any uniq );
use Module::Runtime                   qw( module_notional_filename );
use MooX::StrictConstructor;
use Path::Tiny                  qw( path );
use PPI::Document               ();
use PPIx::Utils::Classification qw(
    is_class_name
    is_function_call
    is_hash_key
    is_method_call
    is_package_declaration
);
use PPIx::Utils::Traversal qw( split_nodes_on_comma );
use Ref::Util              qw( is_plain_arrayref is_plain_hashref );
use Scalar::Util           qw( refaddr );
use Sub::HandlesVia;
use Text::Diff ();
use Try::Tiny  qw( catch try );
use Types::Standard
    qw( ArrayRef Bool HashRef InstanceOf Int Maybe Object Str );

with 'App::perlimports::Role::Logger';

has _annotations => (
    is      => 'ro',
    isa     => InstanceOf ['App::perlimports::Annotations'],
    lazy    => 1,
    default => sub {
        return App::perlimports::Annotations->new(
            ppi_document => shift->ppi_document );
    },
);

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

has _cache_dir => (
    is      => 'ro',
    isa     => InstanceOf ['Path::Tiny'],
    lazy    => 1,
    builder => '_build_cache_dir',
);

has _filename => (
    is       => 'ro',
    isa      => Str,
    init_arg => 'filename',
    required => 1,
);

has _ignore_modules => (
    is       => 'ro',
    isa      => HashRef,
    init_arg => 'ignore_modules',
    default  => sub { +{} },
);

has _ignore_modules_pattern => (
    is       => 'ro',
    isa      => ArrayRef [Str],
    init_arg => 'ignore_modules_pattern',
    default  => sub { [] },
);

# list of PPI::Statement::Include (use, no, require)
# (excluding pragmas, ignored modules, and 'use VERSION')
has includes => (
    is          => 'ro',
    isa         => ArrayRef [Object],    # PPI::Statement::Include



( run in 1.204 second using v1.01-cache-2.11-cpan-63c85eba8c4 )