Specio

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "Moo" : "0",
            "Moose" : "2.1207",
            "Mouse" : "0",
            "Perl::Critic" : "1.138",
            "Perl::Critic::Moose" : "1.05",
            "Perl::Tidy" : "20210111",
            "Pod::Checker" : "1.74",
            "Pod::Coverage::TrustPod" : "0",
            "Pod::Tidy" : "0.10",
            "Pod::Wordlist" : "0",
            "Ref::Util" : "0.112",
            "Sub::Quote" : "0",
            "Test::CPAN::Changes" : "0.19",
            "Test::CPAN::Meta::JSON" : "0.16",
            "Test::EOL" : "0",
            "Test::Mojibake" : "0",
            "Test::More" : "0.88",
            "Test::Needs" : "0",
            "Test::NoTabs" : "0",
            "Test::Pod" : "1.41",
            "Test::Pod::Coverage" : "1.08",

META.json  view on Meta::CPAN

            "Test::Version" : "2.05",
            "Test::Without::Module" : "0",
            "lib" : "0",
            "namespace::autoclean" : "0",
            "open" : "0",
            "utf8" : "0"
         }
      },
      "runtime" : {
         "recommends" : {
            "Ref::Util" : "0.112",
            "Sub::Util" : "1.40"
         },
         "requires" : {
            "B" : "0",
            "Carp" : "0",
            "Clone" : "0",
            "Clone::Choose" : "0",
            "Clone::PP" : "0",
            "Devel::StackTrace" : "0",
            "Eval::Closure" : "0",

META.json  view on Meta::CPAN

            },
            "name" : "@DROLSKY/DROLSKY::MakeMaker",
            "version" : "1.22"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs::Soften",
            "config" : {
               "Dist::Zilla::Plugin::Prereqs::Soften" : {
                  "copy_to" : [],
                  "modules" : [
                     "Ref::Util",
                     "Sub::Util"
                  ],
                  "modules_from_features" : null,
                  "to_relationship" : "recommends"
               }
            },
            "name" : "Prereqs::Soften",
            "version" : "0.006003"
         },
         {

META.yml  view on Meta::CPAN

  Specio::TypeChecks:
    file: lib/Specio/TypeChecks.pm
    version: '0.51'
  Specio::XS:
    file: lib/Specio/XS.pm
    version: '0.51'
  Test::Specio:
    file: lib/Test/Specio.pm
    version: '0.51'
recommends:
  Ref::Util: '0.112'
  Sub::Util: '1.40'
requires:
  B: '0'
  Carp: '0'
  Clone: '0'
  Clone::Choose: '0'
  Clone::PP: '0'
  Devel::StackTrace: '0'
  Eval::Closure: '0'
  Exporter: '0'

META.yml  view on Meta::CPAN

          default_jobs: '12'
          version: '6.033'
      name: '@DROLSKY/DROLSKY::MakeMaker'
      version: '1.22'
    -
      class: Dist::Zilla::Plugin::Prereqs::Soften
      config:
        Dist::Zilla::Plugin::Prereqs::Soften:
          copy_to: []
          modules:
            - Ref::Util
            - Sub::Util
          modules_from_features: ~
          to_relationship: recommends
      name: Prereqs::Soften
      version: '0.006003'
    -
      class: Dist::Zilla::Plugin::Prereqs
      config:
        Dist::Zilla::Plugin::Prereqs:
          phase: develop

README.md  view on Meta::CPAN

- No crazy coercion features

    Moose has some bizarre (and mostly) undocumented features relating to coercions
    and parameterizable types. This is a misfeature.

# OPTIONAL PREREQS

There are several optional prereqs that if installed will make this
distribution better in some way.

- [Ref::Util](https://metacpan.org/pod/Ref%3A%3AUtil)

    Installing this will speed up a number of type checks for built-in types.

- [XString](https://metacpan.org/pod/XString)

    If this is installed it will be loaded instead of the [B](https://metacpan.org/pod/B) module if you have
    Perl 5.10 or greater. This module is much more memory efficient than loading
    all of [B](https://metacpan.org/pod/B).

- [Sub::Util](https://metacpan.org/pod/Sub%3A%3AUtil) or [Sub::Name](https://metacpan.org/pod/Sub%3A%3AName)

cpanfile  view on Meta::CPAN

requires "Test::Fatal" => "0";
requires "Test::More" => "0.96";
requires "Try::Tiny" => "0";
requires "overload" => "0";
requires "parent" => "0";
requires "perl" => "5.008";
requires "re" => "0";
requires "strict" => "0";
requires "version" => "0.83";
requires "warnings" => "0";
recommends "Ref::Util" => "0.112";
recommends "Sub::Util" => "1.40";

on 'test' => sub {
  requires "ExtUtils::MakeMaker" => "0";
  requires "File::Spec" => "0";
  requires "FindBin" => "0";
  requires "Test::More" => "0.96";
  requires "Test::Needs" => "0";
  requires "lib" => "0";
  requires "open" => "0";

cpanfile  view on Meta::CPAN

  requires "Moo" => "0";
  requires "Moose" => "2.1207";
  requires "Mouse" => "0";
  requires "Perl::Critic" => "1.138";
  requires "Perl::Critic::Moose" => "1.05";
  requires "Perl::Tidy" => "20210111";
  requires "Pod::Checker" => "1.74";
  requires "Pod::Coverage::TrustPod" => "0";
  requires "Pod::Tidy" => "0.10";
  requires "Pod::Wordlist" => "0";
  requires "Ref::Util" => "0.112";
  requires "Sub::Quote" => "0";
  requires "Test::CPAN::Changes" => "0.19";
  requires "Test::CPAN::Meta::JSON" => "0.16";
  requires "Test::EOL" => "0";
  requires "Test::Mojibake" => "0";
  requires "Test::More" => "0.88";
  requires "Test::Needs" => "0";
  requires "Test::NoTabs" => "0";
  requires "Test::Pod" => "1.41";
  requires "Test::Pod::Coverage" => "1.08";

dist.ini  view on Meta::CPAN

pod_coverage_skip = Specio::PP
pod_coverage_skip = Specio::XS
stopwords_file = .stopwords
use_github_issues = 1
Test::TidyAll.minimum_perl = 5.010000
-remove = Test::CleanNamespaces
-remove = Test::Pod::No404s
-remove = Test::Synopsis

[Prereqs::Soften]
module = Ref::Util
module = Sub::Util

[Prereqs / DevelopRequires]
Moo = 0
Moose = 2.1207
Mouse = 0
namespace::autoclean = 0
Ref::Util = 0.112
Sub::Quote = 0

[DynamicPrereqs]
-condition = $] >= 5.010
-body = requires('XString')

[MetaNoIndex]
directory = t/lib

[PurePerlTests]

lib/Specio.pm  view on Meta::CPAN


=back

=head1 OPTIONAL PREREQS

There are several optional prereqs that if installed will make this
distribution better in some way.

=over 4

=item * L<Ref::Util>

Installing this will speed up a number of type checks for built-in types.

=item * L<XString>

If this is installed it will be loaded instead of the L<B> module if you have
Perl 5.10 or greater. This module is much more memory efficient than loading
all of L<B>.

=item * L<Sub::Util> or L<Sub::Name>

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

use overload        ();
use re              ();
use Scalar::Util    ();
use Specio::Constraint::Parameterizable;
use Specio::Declare;
use Specio::Helpers ();

BEGIN {
    local $@ = undef;
    my $has_ref_util
        = eval { require Ref::Util; Ref::Util->VERSION('0.112'); 1 };
    sub _HAS_REF_UTIL () {$has_ref_util}
}

declare(
    'Item',
    inline => sub {'1'}
);

declare(
    'Undef',

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

           )
    )
)
EOF
    }
);

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_coderef(%s)'
        : q{ref(%s) eq 'CODE'};

    declare(
        'CodeRef',
        parent => t('Ref'),
        inline => sub {
            return sprintf( <<"EOF", ( $_[1] ) x 3 );
(
    $ref_check
    ||

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

    unless ( exists &re::is_regexp || _HAS_REF_UTIL ) {
        require B;
        *re::is_regexp = sub {
            ## no critic (ErrorHandling::RequireCheckingReturnValueOfEval)
            eval { B::svref_2object( $_[0] )->MAGIC->TYPE eq 'r' };
        };
    }

    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_regexpref(%s)'
        : 're::is_regexp(%s)';

    declare(
        'RegexpRef',
        parent => t('Ref'),
        inline => sub {
            return sprintf( <<"EOF", ( $_[1] ) x 3 );
(
    $ref_check
    ||

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

    )
)
EOF
        },
    );
}

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_globref(%s)'
        : q{ref( %s ) eq 'GLOB'};

    declare(
        'GlobRef',
        parent => t('Ref'),
        inline => sub {
            return sprintf( <<"EOF", ( $_[1] ) x 3 );
(
    $ref_check
    ||

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

    )
)
EOF
        }
    );
}

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_globref(%s)'
        : q{ref( %s ) eq 'GLOB'};

    # NOTE: scalar filehandles are GLOB refs, but a GLOB ref is not always a
    # filehandle
    declare(
        'FileHandle',
        parent => t('Ref'),
        inline => sub {
            return sprintf( <<"EOF", ( $_[1] ) x 6 );
(

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

    )
)
EOF
        }
    );
}

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_blessed_ref(%s)'
        : 'Scalar::Util::blessed(%s)';

    declare(
        'Object',
        parent => t('Ref'),
        inline => sub { sprintf( $ref_check, $_[1] ) },
    );
}

declare(

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

    && length "%s"
    && Specio::Helpers::is_class_loaded( "%s" )
)
EOF
    },
);

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_scalarref(%s) || Ref::Util::is_plain_refref(%s)'
        : q{ref( %s ) eq 'SCALAR' || ref( %s ) eq 'REF'};

    my $base_scalarref_check = sub {
        return sprintf( <<"EOF", ( $_[0] ) x 4 );
(
    (
        $ref_check
    )
    ||
    (

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

                $base_scalarref_check->($val),
                $parameter->inline_check( '${' . $val . '}' ),
            );
        }
    );
}

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_arrayref(%s)'
        : q{ref( %s ) eq 'ARRAY'};

    my $base_arrayref_check = sub {
        return sprintf( <<"EOF", ( $_[0] ) x 3 );
(
    $ref_check
    ||
    (
        Scalar::Util::blessed( %s )
        && defined overload::Method( %s, '\@{}' )

lib/Specio/Library/Builtins.pm  view on Meta::CPAN

                $parameter->inline_check('$_'),
                $val,
            );
        }
    );
}

{
    my $ref_check
        = _HAS_REF_UTIL
        ? 'Ref::Util::is_plain_hashref(%s)'
        : q{ref( %s ) eq 'HASH'};

    my $base_hashref_check = sub {
        return sprintf( <<"EOF", ( $_[0] ) x 3 );
(
    $ref_check
    ||
    (
        Scalar::Util::blessed( %s )
        && defined overload::Method( %s, '%%{}' )

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

                                      'Moo' => '0',
                                      'Moose' => '2.1207',
                                      'Mouse' => '0',
                                      'Perl::Critic' => '1.138',
                                      'Perl::Critic::Moose' => '1.05',
                                      'Perl::Tidy' => '20210111',
                                      'Pod::Checker' => '1.74',
                                      'Pod::Coverage::TrustPod' => '0',
                                      'Pod::Tidy' => '0.10',
                                      'Pod::Wordlist' => '0',
                                      'Ref::Util' => '0.112',
                                      'Sub::Quote' => '0',
                                      'Test::CPAN::Changes' => '0.19',
                                      'Test::CPAN::Meta::JSON' => '0.16',
                                      'Test::EOL' => '0',
                                      'Test::Mojibake' => '0',
                                      'Test::More' => '0.88',
                                      'Test::Needs' => '0',
                                      'Test::NoTabs' => '0',
                                      'Test::Pod' => '1.41',
                                      'Test::Pod::Coverage' => '1.08',

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

                                      'Test::Version' => '2.05',
                                      'Test::Without::Module' => '0',
                                      'lib' => '0',
                                      'namespace::autoclean' => '0',
                                      'open' => '0',
                                      'utf8' => '0'
                                    }
                    },
       'runtime' => {
                      'recommends' => {
                                        'Ref::Util' => '0.112',
                                        'Sub::Util' => '1.40'
                                      },
                      'requires' => {
                                      'B' => '0',
                                      'Carp' => '0',
                                      'Clone' => '0',
                                      'Clone::Choose' => '0',
                                      'Clone::PP' => '0',
                                      'Devel::StackTrace' => '0',
                                      'Eval::Closure' => '0',

xt/author/no-ref-util.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More 0.96;
use Test::Without::Module 'Ref::Util';

use Specio::Library::Builtins;

my @types = qw(
    ArrayRef
    CodeRef
    FileHandle
    GlobRef
    HashRef
    Object
    RegexpRef
    ScalarRef
);

for my $t (@types) {
    my $inline = t($t)->_inline_generator('$_[0]');
    unlike(
        $inline,
        qr/Ref::Util/,
        "inline code for $t does not use Ref::Util when it is not available"
    );
}

open my $fh, '<', 't/builtins-sanity.t' or die $!;
## no critic (BuiltinFunctions::ProhibitStringyEval, ErrorHandling::RequireCheckingReturnValueOfEval)
eval do { local $/ = undef; <$fh> };
die $@ if $@;
close $fh or die $!;



( run in 0.322 second using v1.01-cache-2.11-cpan-a5abf4f5562 )