File Coverage

blib/lib/Catmandu/Fix/Datahub.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 7 7 100.0


line stmt bran cond sub pod time code
1             package Catmandu::Fix::Datahub;
2              
3 1     1   484 use strict;
  1         1  
  1         20  
4 1     1   15 use 5.008_005;
  1         2  
5             our $VERSION = '0.01';
6              
7             1;
8             __END__
9              
10             =encoding utf-8
11              
12             =head1 NAME
13              
14             =for html <a href="https://travis-ci.org/thedatahub/Catmandu-Fix-Datahub"><img src="https://travis-ci.org/thedatahub/Catmandu-Fix-Datahub.svg?branch=master"></a>
15              
16             Catmandu::Fix::Datahub - Utility functions and generic fixes developed for the Datahub project
17              
18             =head1 SYNOPSIS
19              
20             use Catmandu::Fix::Datahub::Util;
21              
22             =head1 FUNCTIONS
23              
24             =head2 C<Catmandu::Fix::Datahub::Util>
25              
26             use Catmandu::Fix::Datahub::Util;
27              
28             =over 4
29              
30             =item C<declare_source($fixer, $var, $declared_var)>
31              
32             For an item C<$var>, which is a path (as a string) in a Catmandu fix, assign the value at the path to C<$declared_var>,
33             which is a variable that was previously declared in the fix code:
34              
35             my $f_var = $self->fixer->generate_var();
36             $code .= "my ${f_var};";
37             $code .= declare_source($self->fixer, 'foo.bar', $f_var);
38              
39             =item C<walk($fixer, $path, $key, $h)>
40              
41             Walk through a C<$path> (as an arrayref) until at C<$key>. Assign the value of C<$key> to C<$h>.
42             C<$h> must be declared in the fix code.
43              
44             my $f_var = $self->fixer->generate_var();
45             $code .= "my ${f_var};";
46             $code .= walk($self->fixer, ['foo', 'bar'], $f_var);
47              
48             =back
49              
50             =head1 AUTHOR
51              
52             Pieter De Praetere E<lt>pieter@packed.beE<gt>
53              
54             =head1 COPYRIGHT
55              
56             Copyright 2017- PACKED vzw
57              
58             =head1 LICENSE
59              
60             This library is free software; you can redistribute it and/or modify
61             it under the same terms as Perl itself.
62              
63             =head1 SEE ALSO
64              
65             L<Catmandu>
66              
67             =cut