line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
377838
|
use 5.008008; |
|
5
|
|
|
|
|
50
|
|
2
|
5
|
|
|
5
|
|
30
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
130
|
|
3
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
353
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Ask; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.015'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
36
|
use Carp qw(croak); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
276
|
|
11
|
5
|
|
|
5
|
|
2469
|
use Moo::Role qw(); |
|
5
|
|
|
|
|
79037
|
|
|
5
|
|
|
|
|
147
|
|
12
|
5
|
|
|
5
|
|
39
|
use Module::Runtime qw(use_module use_package_optimistically); |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
30
|
|
13
|
|
|
|
|
|
|
use Module::Pluggable ( |
14
|
5
|
|
|
|
|
46
|
search_path => 'Ask', |
15
|
|
|
|
|
|
|
except => [qw/ Ask::API Ask::Functions Ask::Question /], |
16
|
|
|
|
|
|
|
inner => 0, |
17
|
|
|
|
|
|
|
require => 0, |
18
|
|
|
|
|
|
|
sub_name => '__plugins', |
19
|
5
|
|
|
5
|
|
2834
|
); |
|
5
|
|
|
|
|
45337
|
|
20
|
5
|
|
|
5
|
|
2933
|
use namespace::autoclean; |
|
5
|
|
|
|
|
68318
|
|
|
5
|
|
|
|
|
21
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub import { |
23
|
5
|
|
|
5
|
|
42
|
shift; |
24
|
5
|
50
|
|
|
|
3648
|
if ( @_ ) { |
25
|
0
|
|
|
|
|
0
|
require Ask::Functions; |
26
|
0
|
|
|
|
|
0
|
unshift @_, 'Ask::Functions'; |
27
|
0
|
|
|
|
|
0
|
goto( $_[0]->can( 'import' ) ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub plugins { |
32
|
3
|
|
|
3
|
1
|
19
|
__plugins( @_ ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub backends { |
36
|
3
|
|
|
3
|
1
|
7
|
my $class = shift; |
37
|
30
|
|
|
|
|
324
|
sort { $b->quality <=> $a->quality } |
38
|
|
|
|
|
|
|
grep { |
39
|
3
|
|
|
|
|
34
|
eval { use_package_optimistically( $_ )->DOES( 'Ask::API' ) } |
|
30
|
|
|
|
|
20000
|
|
|
30
|
|
|
|
|
125
|
|
40
|
|
|
|
|
|
|
} $class->plugins; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub detect { |
44
|
3
|
|
|
3
|
1
|
302
|
my $class = shift; |
45
|
3
|
50
|
|
|
|
24
|
my %args = @_ == 1 ? %{ $_[0] } : @_; |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
16
|
my @implementations = $class->backends; |
48
|
|
|
|
|
|
|
|
49
|
3
|
50
|
0
|
|
|
22
|
if ( exists $ENV{PERL_ASK_BACKEND} ) { |
|
|
0
|
0
|
|
|
|
|
50
|
3
|
|
|
|
|
15
|
@implementations = use_module( $ENV{PERL_ASK_BACKEND} ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif ( $ENV{AUTOMATED_TESTING} |
53
|
|
|
|
|
|
|
or $ENV{PERL_MM_USE_DEFAULT} |
54
|
|
|
|
|
|
|
or not @implementations ) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
0
|
@implementations = use_module( 'Ask::Fallback' ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
3
|
100
|
|
|
|
122
|
my @traits = @{ delete( $args{traits} ) || [] }; |
|
3
|
|
|
|
|
27
|
|
60
|
3
|
|
|
|
|
13
|
for my $i ( @implementations ) { |
61
|
3
|
100
|
|
|
|
14
|
my $k = @traits ? "Moo::Role"->create_class_with_roles( $i, @traits ) : $i; |
62
|
3
|
50
|
|
|
|
824
|
my $self = eval { $k->new( { %args, %{ $args{$i} or {} } } ) } or next; |
|
3
|
50
|
|
|
|
13
|
|
|
3
|
|
|
|
|
56
|
|
63
|
3
|
50
|
|
|
|
6251
|
return $self if $self->is_usable; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
0
|
croak "No usable backend for Ask"; |
67
|
|
|
|
|
|
|
} #/ sub detect |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub Q { |
70
|
1
|
|
|
1
|
0
|
10894
|
require Ask::Question; |
71
|
1
|
|
|
|
|
10
|
'Ask::Question'->new( @_ ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $instance; |
75
|
|
|
|
|
|
|
sub instance { |
76
|
0
|
|
|
0
|
1
|
|
shift; |
77
|
0
|
0
|
0
|
|
|
|
@_ ? ( $instance = $_[0] ) : ( $instance ||= __PACKAGE__->detect ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |