blib/lib/Merge/HashRef.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 25 / 25 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Test/HashRef.pm ↑ Summary
1 package Merge::HashRef;
2  
3 1 $Merge::HashRef::VERSION = '0.01';
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base 'Exporter::Simple';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Merge::HashRef - make one hashref out of many!
14  
15 =head1 SYNOPSIS
16  
17 use Merge::HashRef;
18  
19 my $hashref = merge_hashref($ref1, $ref2, ...)
20  
21 =head1 DESCRIPTION
22  
23 Recently, I found myself turning lots of hashrefs into a single one.
24 And, I thought, this would be a nice little function to have.
25  
26 So now you have it too!
27  
28 =head2 merge_hashref
29  
30 my $hashref = merge_hashref($ref1, $ref2, ...)
31  
32 This takes a list of hashrefs, and returns you one. Of course, the order
33 you pass your hashrefs in IS important, as later key/value pairs will
34 clobber earlier ones. This is deliberate. This is why I wrote this little
35 module!
36  
37 All non-hashrefs get removed from the passed-in list. So don't be doing that.
38  
39 =cut
40  
41 1 ▶sub merge_hashref : Exported { return { map %$_, grep ref $_ eq 'HASH', @_ } }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine merge_hashref: called CC=1 SCAR=0.0
Pod documented
42  
43  
44 =head1 SHOWING YOUR APPRECIATION
45  
46 There was a thread on london.pm mailing list about working
47 in a vacumn - that it was a bit depressing to keep writing
48 modules but never get any feedback. So, if you use and
49 like this module then please send me an email and make my
50 day.
51  
52 All it takes is a few little bytes.
53  
54 (Leon wrote that, not me!)
55  
56 =head1 AUTHOR
57  
58 Stray Toaster, E<lt>coder@stray-toaster.co.ukE<gt>
59  
60 =head1 COPYRIGHT AND LICENSE
61  
62 Copyright 2002 by Stray Toaster
63  
64 This library is free software; you can redistribute it and/or modify
65 it under the same terms as Perl itself.
66  
67 =cut
68  
69 1 1;
« Test/HashRef.pm ↑ Summary