File Coverage

blib/lib/Syntax/Keyword/Junction/Base.pm
Criterion Covered Total %
statement 20 21 95.2
branch 4 10 40.0
condition 1 3 33.3
subroutine 8 8 100.0
pod 0 3 0.0
total 33 45 73.3


line stmt bran cond sub pod time code
1             package Syntax::Keyword::Junction::Base;
2 16     16   222439 use strict;
  16         43  
  16         730  
3 16     16   87 use warnings;
  16         30  
  16         3227  
4              
5             our $VERSION = '0.003009';
6              
7             BEGIN {
8 16 50 33 16   287 *_WANT_SMARTMATCH = ("$]" >= 5.010001 && "$]" < 5.041000) ? sub(){1} : sub(){0};
9 16 0       119 my $category
    0          
    50          
10             = "$]" >= 5.041000 ? undef
11             : "$]" >= 5.037011 ? 'deprecated::smartmatch'
12             : "$]" >= 5.017011 ? 'experimental::smartmatch'
13             : undef;
14 16         1884 *_SMARTMATCH_WARNING_CATEGORY = sub(){$category};
  0         0  
15             }
16              
17             use overload(
18             '==' => "num_eq",
19             '!=' => "num_ne",
20             '>=' => "num_ge",
21             '>' => "num_gt",
22             '<=' => "num_le",
23             '<' => "num_lt",
24             'eq' => "str_eq",
25             'ne' => "str_ne",
26             'ge' => "str_ge",
27             'gt' => "str_gt",
28             'le' => "str_le",
29             'lt' => "str_lt",
30             'bool' => "bool",
31 4     4   1881 '""' => sub {shift},
32 16         203 ('~~' => 'match') x!! _WANT_SMARTMATCH,
33 16     16   5179 );
  16         15792  
34              
35              
36 388     388 0 2728 sub new { bless \@_, shift }
37              
38             sub values {
39 16     16 0 5384 my $self = shift;
40 16 100       130 return wantarray ? @$self : [ @$self ];
41             }
42              
43             sub map {
44 4     4 0 2941 my ( $self, $code ) = @_;
45 4         14 my $class = ref $self;
46 4         16 $class->new( map { $code->( $_ ) } $self->values );
  20         75  
47             }
48              
49             1;
50              
51             __END__
52              
53             =pod
54              
55             =encoding UTF-8
56              
57             =for :stopwords Arthur Axel "fREW" Schmidt Carl Franks
58              
59             =head1 BUGS
60              
61             Please report any bugs or feature requests on the bugtracker website
62             L<https://github.com/haarg/Syntax-Keyword-Junction/issues>
63              
64             When submitting a bug or request, please include a test-file or a
65             patch to an existing test-file that illustrates the bug or desired
66             feature.
67              
68             =head1 AUTHORS
69              
70             =over 4
71              
72             =item *
73              
74             Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
75              
76             =item *
77              
78             Carl Franks
79              
80             =back
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             =cut