File Coverage

blib/lib/autobox/Junctions.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod n/a
total 43 43 100.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of autobox-Junctions
3             #
4             # This software is Copyright (c) 2013 by Chris Weyl.
5             #
6             # This is free software, licensed under:
7             #
8             # The GNU Lesser General Public License, Version 2.1, February 1999
9             #
10             package autobox::Junctions;
11             BEGIN {
12 1     1   19049 $autobox::Junctions::AUTHORITY = 'cpan:RSRCHBOY';
13             }
14             {
15             $autobox::Junctions::VERSION = '0.001';
16             }
17             # git description: 20530a8
18              
19              
20             # ABSTRACT: Autoboxified junction-style operators
21              
22 1     1   7 use strict;
  1         2  
  1         28  
23 1     1   4 use warnings;
  1         2  
  1         27  
24              
25 1     1   698 use parent 'autobox';
  1         331  
  1         6  
26              
27             sub import {
28 1     1   12 my $class = shift @_;
29              
30 1         20 $class->SUPER::import(
31             ARRAY => 'autobox::Junctions::ARRAY',
32             @_,
33             );
34             }
35              
36             {
37             package autobox::Junctions::ARRAY;
38             BEGIN {
39 1     1   16273 $autobox::Junctions::ARRAY::AUTHORITY = 'cpan:RSRCHBOY';
40             }
41             {
42             $autobox::Junctions::ARRAY::VERSION = '0.001';
43             }
44             # git description: 20530a8
45              
46              
47 1     1   11 use strict;
  1         3  
  1         35  
48 1     1   6 use warnings;
  1         2  
  1         42  
49              
50 1     1   1013 use Syntax::Keyword::Junction ();
  1         16081  
  1         123  
51              
52 2     2   781 sub all { Syntax::Keyword::Junction::all( @{ $_[0] }) }
  2         8  
53 2     2   3238 sub any { Syntax::Keyword::Junction::any( @{ $_[0] }) }
  2         16  
54 2     2   976 sub none { Syntax::Keyword::Junction::none(@{ $_[0] }) }
  2         11  
55 2     2   852 sub one { Syntax::Keyword::Junction::one( @{ $_[0] }) }
  2         9  
56             }
57              
58             !!42;
59              
60             __END__
61              
62             =pod
63              
64             =encoding utf-8
65              
66             =for :stopwords Chris Weyl autoboxified autoboxifying AUTOBOXED
67              
68             =head1 NAME
69              
70             autobox::Junctions - Autoboxified junction-style operators
71              
72             =head1 VERSION
73              
74             This document describes version 0.001 of autobox::Junctions - released October 03, 2013 as part of autobox-Junctions.
75              
76             =head1 SYNOPSIS
77              
78             # somewhere above...
79             use autobox::Junctions;
80              
81             # somewhere below...
82             my @explodey = qw{ bing bang boom };
83             warn "boom!\n"
84             if @explody->any eq 'boom';
85              
86             my $still_explody = [ @explodey ];
87             warn "not all explody\n"
88             unless $still_explody->all eq 'boom';
89              
90             # now, bonus points...
91             use autobox::Core;
92              
93             my $weapons = {
94             mateu => 'bow & arrow', # fearsome hunter
95             ether => 'disarming smile', # Canadian
96             jnap => 'shotgun', # upstate NY
97             };
98              
99             warn 'mateu is armed!'
100             if $weapons->keys->any eq 'mateu'
101              
102             warn '...but at least no one has a nuke'
103             if $weapons->values->none eq 'nuke';
104              
105             =head1 DESCRIPTION
106              
107             This is a simple autoboxifying wrapper around L<Syntax::Keyword::Junction>,
108             that provides array and array references with the functions provided by that
109             package as methods for arrays:
110             L<any|Syntax::Keyword::Junction/any>,
111             L<all|Syntax::Keyword::Junction/all>, L<one|Syntax::Keyword::Junction/one>,
112             and L<none|Syntax::Keyword::Junction/none>.
113              
114             =head1 AUTOBOXED METHODS
115              
116             See: L<Syntax::Keyword::Junction/any>, LSyntax::Keyword::Junction/all>,
117             L<Syntax::Keyword::Junction/one>, and L<Syntax::Keyword::Junction/none>.
118              
119             =head1 SEE ALSO
120              
121             Please see those modules/websites for more information related to this module.
122              
123             =over 4
124              
125             =item *
126              
127             L<Syntax::Keyword::Junction|Syntax::Keyword::Junction>
128              
129             =back
130              
131             =head1 SOURCE
132              
133             The development version is on github at L<http://github.com/RsrchBoy/autobox-Junctions>
134             and may be cloned from L<git://github.com/RsrchBoy/autobox-Junctions.git>
135              
136             =head1 BUGS
137              
138             Please report any bugs or feature requests on the bugtracker website
139             https://github.com/RsrchBoy/autobox-Junctions/issues
140              
141             When submitting a bug or request, please include a test-file or a
142             patch to an existing test-file that illustrates the bug or desired
143             feature.
144              
145             =head1 AUTHOR
146              
147             Chris Weyl <cweyl@alumni.drew.edu>
148              
149             =head1 COPYRIGHT AND LICENSE
150              
151             This software is Copyright (c) 2013 by Chris Weyl.
152              
153             This is free software, licensed under:
154              
155             The GNU Lesser General Public License, Version 2.1, February 1999
156              
157             =cut