line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Config-Model |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2005-2022 by Dominique Dumont. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Load Node element in configuration tree |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Mouse::Role; |
14
|
59
|
|
|
59
|
|
28676
|
use strict; |
|
59
|
|
|
|
|
146
|
|
|
59
|
|
|
|
|
468
|
|
15
|
59
|
|
|
59
|
|
17663
|
use warnings; |
|
59
|
|
|
|
|
144
|
|
|
59
|
|
|
|
|
931
|
|
16
|
59
|
|
|
59
|
|
273
|
use Carp; |
|
59
|
|
|
|
|
131
|
|
|
59
|
|
|
|
|
1400
|
|
17
|
59
|
|
|
59
|
|
301
|
use 5.10.0; |
|
59
|
|
|
|
|
126
|
|
|
59
|
|
|
|
|
3210
|
|
18
|
59
|
|
|
59
|
|
844
|
|
|
59
|
|
|
|
|
225
|
|
19
|
|
|
|
|
|
|
use Mouse::Util; |
20
|
59
|
|
|
59
|
|
334
|
use Log::Log4perl qw(get_logger :levels); |
|
59
|
|
|
|
|
138
|
|
|
59
|
|
|
|
|
373
|
|
21
|
59
|
|
|
59
|
|
4291
|
|
|
59
|
|
|
|
|
144
|
|
|
59
|
|
|
|
|
458
|
|
22
|
|
|
|
|
|
|
my $load_logger = get_logger("TreeLoad"); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ($self, %params) = @_ ; |
25
|
|
|
|
|
|
|
|
26
|
764
|
|
|
764
|
1
|
4043
|
my $config_class_name = $params{config_class_name}; |
27
|
|
|
|
|
|
|
my $config_class = $self->config_model->get_model_clone($config_class_name) ; |
28
|
764
|
|
|
|
|
1778
|
my $node_class = $config_class->{class} || 'Config::Model::Node'; |
29
|
764
|
|
|
|
|
4127
|
$load_logger->debug("Loading $config_class_name ". $self->location . " with $node_class"); |
30
|
764
|
|
100
|
|
|
56082
|
Mouse::Util::load_class($node_class); |
31
|
764
|
|
|
|
|
5617
|
|
32
|
764
|
|
|
|
|
8827
|
if (delete $params{check}) { |
33
|
|
|
|
|
|
|
carp "load_node; drop check param. Better let node query the instance"; |
34
|
764
|
50
|
|
|
|
14527
|
} |
35
|
0
|
|
|
|
|
0
|
$params{gist} //= $config_class->{gist} if $config_class->{gist}; |
36
|
|
|
|
|
|
|
return $node_class->new(%params) ; |
37
|
764
|
100
|
33
|
|
|
2281
|
} |
38
|
764
|
|
|
|
|
24037
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Config::Model::Role::NodeLoader - Load Node element in configuration tree |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 2.151 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SYNOPSIS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$self->load_node( config_class_name => "...", %other_args); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Role used to load a node element using L<Config::Model::Node> (default behavior). |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
If the config class overrides the default implementation, ( C<class> parameter ), the |
63
|
|
|
|
|
|
|
override class is loaded and used to create the node. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 load_node |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Creates a node object using all the named parameters passed to load_node. One of these |
70
|
|
|
|
|
|
|
parameter must be C<config_class_name> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Dominique Dumont |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is Copyright (c) 2005-2022 by Dominique Dumont. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, licensed under: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |