File Coverage

blib/lib/Combine/Keys.pm
Criterion Covered Total %
statement 26 26 100.0
branch 5 6 83.3
condition n/a
subroutine 6 6 100.0
pod 1 2 50.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             package Combine::Keys;
2              
3 3     3   48665 use strict;
  3         5  
  3         83  
4 3     3   13 use warnings;
  3         4  
  3         611  
5              
6             our $VERSION = '0.07';
7             require XSLoader;
8             XSLoader::load('Combine::Keys', $VERSION);
9              
10             our %EXPORTING = (
11             ckeys => [qw/all xs/],
12             combine_keys => [qw/all perl/],
13             );
14              
15             sub import {
16 3     3   18 my ($pkg, @export) = @_;
17 3         7 my $caller = caller();
18 3         9 export($pkg, $caller, @export);
19             }
20              
21             sub export {
22 5     5 0 7 my ($pkg, $caller) = (shift, shift);
23 5         26 while (my $ex = shift) {
24 7 100       14 if (! exists $EXPORTING{$ex} ) {
25             my @export = grep {
26 2         4 grep { $_ eq $ex } @{ $EXPORTING{$_} }
  4         3  
  8         15  
  4         5  
27             } keys %EXPORTING;
28             @export
29 2 50       10 ? return export($pkg, $caller, (@export, @_))
30             : die "$ex is not exported";
31             }
32            
33 3     3   14 no strict 'refs';
  3         10  
  3         416  
34 5 100       1225 $caller->can($ex) and next; # qw/all perl/
35 4         5 *{"${caller}::${ex}"} = \&{"${pkg}::${ex}"};
  4         1786  
  4         19  
36             }
37             }
38              
39             sub combine_keys {
40 4     4 1 3872 return @{ ckeys([@_]) };
  4         56  
41             }
42              
43             =head1 NAME
44              
45             Combine::Keys - keys on multiple hash references
46              
47             =head1 VERSION
48              
49             Version 0.07
50              
51             =cut
52              
53             =head1 SYNOPSIS
54              
55             Quick summary of what the module does.
56              
57             use Combine::Keys qw/combine_keys/;
58              
59             for ( combine_keys($hash1, \%hash2, { e => 'f' }) ) {
60             .... magic ---
61             }
62              
63             =head1 EXPORT
64              
65             =head1 SUBROUTINES/METHODS
66              
67             =head2 combine_keys
68              
69             Takes an Array of hash references and returns an array of keys.
70              
71             =head2 ckeys
72              
73             Takes an Array reference of hashes and returns an array reference of keys.
74              
75             =cut
76              
77             =head1 AUTHOR
78              
79             Robert Acock, C<< >>
80              
81             =head1 BUGS
82              
83             Please report any bugs or feature requests to C, or through
84             the web interface at L. I will be notified, and then you'll
85             automatically be notified of progress on your bug as I make changes.
86              
87             =head1 SUPPORT
88              
89             You can find documentation for this module with the perldoc command.
90              
91             perldoc Combine::Keys
92              
93             You can also look for information at:
94              
95             =over 4
96              
97             =item * RT: CPAN's request tracker (report bugs here)
98              
99             L
100              
101             =item * AnnoCPAN: Annotated CPAN documentation
102              
103             L
104              
105             =item * CPAN Ratings
106              
107             L
108              
109             =item * Search CPAN
110              
111             L
112              
113             =back
114              
115             =head1 ACKNOWLEDGEMENTS
116              
117             =head1 LICENSE AND COPYRIGHT
118              
119             Copyright 2017 Robert Acock.
120              
121             This program is free software; you can redistribute it and/or modify it
122             under the terms of the the Artistic License (2.0). You may obtain a
123             copy of the full license at:
124              
125             L
126              
127             Any use, modification, and distribution of the Standard or Modified
128             Versions is governed by this Artistic License. By using, modifying or
129             distributing the Package, you accept this license. Do not use, modify,
130             or distribute the Package, if you do not accept this license.
131              
132             If your Modified Version has been derived from a Modified Version made
133             by someone other than you, you are nevertheless required to ensure that
134             your Modified Version complies with the requirements of this license.
135              
136             This license does not grant you the right to use any trademark, service
137             mark, tradename, or logo of the Copyright Holder.
138              
139             This license includes the non-exclusive, worldwide, free-of-charge
140             patent license to make, have made, use, offer to sell, sell, import and
141             otherwise transfer the Package with respect to any patent claims
142             licensable by the Copyright Holder that are necessarily infringed by the
143             Package. If you institute patent litigation (including a cross-claim or
144             counterclaim) against any party alleging that the Package constitutes
145             direct or contributory patent infringement, then this Artistic License
146             to you shall terminate on the date that such litigation is filed.
147              
148             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
149             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
150             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
151             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
152             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
153             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
154             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
155             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
156              
157             =cut
158              
159             1; # End of Combine::Keys