← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:05 2021

Filename/usr/local/lib/perl5/site_perl/Specio/Constraint/AnyCan.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sSpecio::Constraint::AnyCan::::BEGIN@10Specio::Constraint::AnyCan::BEGIN@10
0000s0sSpecio::Constraint::AnyCan::::BEGIN@11Specio::Constraint::AnyCan::BEGIN@11
0000s0sSpecio::Constraint::AnyCan::::BEGIN@12Specio::Constraint::AnyCan::BEGIN@12
0000s0sSpecio::Constraint::AnyCan::::BEGIN@13Specio::Constraint::AnyCan::BEGIN@13
0000s0sSpecio::Constraint::AnyCan::::BEGIN@15Specio::Constraint::AnyCan::BEGIN@15
0000s0sSpecio::Constraint::AnyCan::::BEGIN@3Specio::Constraint::AnyCan::BEGIN@3
0000s0sSpecio::Constraint::AnyCan::::BEGIN@4Specio::Constraint::AnyCan::BEGIN@4
0000s0sSpecio::Constraint::AnyCan::::BEGIN@8Specio::Constraint::AnyCan::BEGIN@8
0000s0sSpecio::Constraint::AnyCan::::BEGIN@9Specio::Constraint::AnyCan::BEGIN@9
0000s0sSpecio::Constraint::AnyCan::::__ANON__Specio::Constraint::AnyCan::__ANON__ (xsub)
0000s0sSpecio::Constraint::AnyCan::::__ANON__[:57]Specio::Constraint::AnyCan::__ANON__[:57]
0000s0sSpecio::Constraint::AnyCan::::_allow_classesSpecio::Constraint::AnyCan::_allow_classes
0000s0sSpecio::Constraint::AnyCan::::_build_inline_generatorSpecio::Constraint::AnyCan::_build_inline_generator
0000s0sSpecio::Constraint::AnyCan::::_build_parentSpecio::Constraint::AnyCan::_build_parent
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Specio::Constraint::AnyCan;
2
3use strict;
4use warnings;
5
6our $VERSION = '0.47';
7
8use List::Util 1.33 ();
9use Role::Tiny::With;
10use Scalar::Util ();
11use Specio::Helpers qw( perlstring );
12use Specio::Library::Builtins;
13use Specio::OO;
14
15use Specio::Constraint::Role::CanType;
16with 'Specio::Constraint::Role::CanType';
17
18{
19 my $Defined = t('Defined');
20 sub _build_parent {$Defined}
21}
22
23{
24 my $_inline_generator = sub {
25 my $self = shift;
26 my $val = shift;
27
28 my $methods = join ', ', map { perlstring($_) } @{ $self->methods };
29 return sprintf( <<'EOF', $val, $methods );
30(
31 do {
32 # We need to assign this since if it's something like $_[0] then
33 # inside the all block @_ gets redefined and we can no longer get at
34 # the value.
35 my $v = %s;
36 (
37 Scalar::Util::blessed($v) || (
38 defined($v)
39 && !ref($v)
40 && length($v)
41 && $v !~ /\A
42 \s*
43 -?[0-9]+(?:\.[0-9]+)?
44 (?:[Ee][\-+]?[0-9]+)?
45 \s*
46 \z/xs
47
48 # Passing a GLOB from (my $glob = *GLOB) gives us a very weird
49 # scalar. It's not a ref and it has a length but trying to
50 # call ->can on it throws an exception
51 && ref( \$v ) ne 'GLOB'
52 )
53 ) && List::Util::all { $v->can($_) } %s;
54 }
55 )
56EOF
57 };
58
59 sub _build_inline_generator {$_inline_generator}
60}
61
62## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
63sub _allow_classes {1}
64## use critic
65
66__PACKAGE__->_ooify;
67
681;
69
70# ABSTRACT: A class for constraints which require a class name or object with a set of methods
71
72__END__