File Coverage

blib/lib/Template/Plugin/HashMergeVMethods.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Template::Plugin::HashMergeVMethods;
2              
3 2     2   4514 use strict;
  2         4  
  2         57  
4 2     2   11 use warnings;
  2         4  
  2         53  
5              
6 2     2   9 use vars qw($VERSION @ISA $VMETHOD_PACKAGE @HASH_OPS);
  2         3  
  2         144  
7              
8 2     2   1544 use Template::Plugin::VMethods;
  2         17667  
  2         14  
9 2     2   49 use Template::Plugin::HashMerge;
  2         3  
  2         121  
10              
11             $VERSION = '0.01';
12             @ISA = qw(Template::Plugin::VMethods);
13             $VMETHOD_PACKAGE = 'Template::Plugin::HashMerge';
14              
15             @HASH_OPS = qw(merge);
16              
17             =head1 NAME
18              
19             Template::Plugin::HashMergeVMethods - virtual methods for TT2 hashes to merge them
20              
21             =head1 SYNOPSIS
22              
23             [% USE HashMerge %]
24             [% USE HashMergeVMethods %]
25             [% a = {
26             foo => 1,
27             bar => [ 'a', 'b', 'e' ],
28             baz => {
29             bob => 'alice',
30             },
31             };
32             b = {
33             foo => 2,
34             bar => [ 'c', 'd' ],
35             baz => {
36             ted => 'margeret',
37             },
38             };
39             HashMerge.set_behaviour( 'RIGHT_PRECEDENT' );
40             c = a.merge( b ); %]
41              
42             =head1 DESCRIPTION
43              
44             L plugin HashMergeVMethods provides the L
45             functions C and C to be used within templates as
46             virtual methods of hashes.
47              
48             This can be useful in all cases a template works directly on data - e.g.
49             when processing results from a query using L and join the
50             result with results from derived queries.
51              
52             =head1 USAGE
53              
54             [% USE HashMerge %]
55             [% USE HashMergeVMethods %]
56             [% HashMerge.set_behaviour( );
57             result = hash1.merge( hash2 ); %]
58              
59             Detailed function description and default behaviours are available in
60             L.
61              
62             If you prefer to use object methods, see L.
63              
64             =head1 FUNCTIONS PROVIDED
65              
66             =head2 merge
67              
68             =head1 BUGS & LIMITATIONS
69              
70             None known.
71              
72             =head1 SUPPORT
73              
74             Free support can be requested via regular CPAN bug-tracking system. There is
75             no guaranteed reaction time or solution time. It depends on business load.
76             That doesn't mean that ticket via rt aren't handles as soon as possible,
77             that means that soon depends on how much I have to do.
78              
79             Business and commercial support should be aquired via preferred freelancer
80             agencies.
81              
82             =head1 AUTHOR
83              
84             Jens Rehsack
85             CPAN ID: REHSACK
86             rehsack@cpan.org
87             http://search.cpan.org/~rehsack/
88              
89             =head1 COPYRIGHT
90              
91             This program is free software; you can redistribute
92             it and/or modify it under the same terms as Perl itself.
93              
94             The full text of the license can be found in the
95             LICENSE file included with this module.
96              
97              
98             =head1 SEE ALSO
99              
100             perl(1), L, L
101              
102             =cut
103              
104             1;