line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Context::Actions; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2012-04-13 09:54:58 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
24730
|
use Moose; |
|
3
|
|
|
|
|
356950
|
|
|
3
|
|
|
|
|
25
|
|
10
|
3
|
|
|
3
|
|
17110
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
85
|
|
11
|
3
|
|
|
3
|
|
585
|
use version; |
|
3
|
|
|
|
|
1457
|
|
|
3
|
|
|
|
|
21
|
|
12
|
3
|
|
|
3
|
|
177
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
204
|
|
13
|
3
|
|
|
3
|
|
13
|
use Scalar::Util; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
117
|
|
14
|
3
|
|
|
3
|
|
11
|
use List::Util; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
163
|
|
15
|
3
|
|
|
3
|
|
577
|
use Data::Dumper qw/Dumper/; |
|
3
|
|
|
|
|
5584
|
|
|
3
|
|
|
|
|
182
|
|
16
|
3
|
|
|
3
|
|
702
|
use English qw/ -no_match_vars /; |
|
3
|
|
|
|
|
4453
|
|
|
3
|
|
|
|
|
63
|
|
17
|
3
|
|
|
3
|
|
1857
|
use Data::Context::Util qw/lol_path lol_iterate/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
752
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = version->new('0.1.10'); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub expand_vars { |
22
|
3
|
|
|
3
|
1
|
1102
|
my ( $self, $value, $vars, $path, $dci ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
3
|
100
|
|
|
|
8
|
if ( ref $value eq 'HASH' ) { |
25
|
1
|
50
|
|
|
|
4
|
if ( !exists $value->{value} ) { |
26
|
0
|
0
|
|
|
|
0
|
$dci->dc->log->warn( "expand_vars called as a hash but without a value in ".$dci->path." at $path" ) if $dci; |
27
|
0
|
|
|
|
|
0
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
1
|
|
|
|
|
2
|
$value = $value->{value} ; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# remove #'s |
33
|
3
|
|
|
|
|
11
|
$value =~ s/^[#] | [#]$//gxms; |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
8
|
return Data::Context::Util::lol_path( $vars, $value ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Data::Context::Actions - Contains all the default actions available to a config |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This documentation refers to Data::Context::Actions version 0.1.10. |
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Data::Context::Actions; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# expand variables |
54
|
|
|
|
|
|
|
my $expanded = Data::Context::Actions->expand_var( '#path.to.item#', undef, 'path.in.config', {...} ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 C<expand_vars ( $value, $dc, $path, $vars )> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Expands C<$value> in C<$vars> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
There are no known bugs in this module. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Patches are welcome. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
87
|
|
|
|
|
|
|
All rights reserved. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
90
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
91
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
92
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
93
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |