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
|
|
28113
|
use strict; |
|
59
|
|
|
|
|
153
|
|
|
59
|
|
|
|
|
424
|
|
15
|
59
|
|
|
59
|
|
17303
|
use warnings; |
|
59
|
|
|
|
|
152
|
|
|
59
|
|
|
|
|
964
|
|
16
|
59
|
|
|
59
|
|
259
|
use Carp; |
|
59
|
|
|
|
|
124
|
|
|
59
|
|
|
|
|
1370
|
|
17
|
59
|
|
|
59
|
|
290
|
use 5.10.0; |
|
59
|
|
|
|
|
133
|
|
|
59
|
|
|
|
|
3180
|
|
18
|
59
|
|
|
59
|
|
757
|
|
|
59
|
|
|
|
|
218
|
|
19
|
|
|
|
|
|
|
use Mouse::Util; |
20
|
59
|
|
|
59
|
|
332
|
use Log::Log4perl qw(get_logger :levels); |
|
59
|
|
|
|
|
112
|
|
|
59
|
|
|
|
|
411
|
|
21
|
59
|
|
|
59
|
|
4171
|
|
|
59
|
|
|
|
|
138
|
|
|
59
|
|
|
|
|
448
|
|
22
|
|
|
|
|
|
|
my $load_logger = get_logger("TreeLoad"); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ($self, %params) = @_ ; |
25
|
|
|
|
|
|
|
|
26
|
764
|
|
|
764
|
1
|
3911
|
my $config_class_name = $params{config_class_name}; |
27
|
|
|
|
|
|
|
my $config_class = $self->config_model->get_model_clone($config_class_name) ; |
28
|
764
|
|
|
|
|
1831
|
my $node_class = $config_class->{class} || 'Config::Model::Node'; |
29
|
764
|
|
|
|
|
4362
|
$load_logger->debug("Loading $config_class_name ". $self->location . " with $node_class"); |
30
|
764
|
|
100
|
|
|
58797
|
Mouse::Util::load_class($node_class); |
31
|
764
|
|
|
|
|
5824
|
|
32
|
764
|
|
|
|
|
9012
|
if (delete $params{check}) { |
33
|
|
|
|
|
|
|
carp "load_node; drop check param. Better let node query the instance"; |
34
|
764
|
50
|
|
|
|
14636
|
} |
35
|
0
|
|
|
|
|
0
|
$params{gist} //= $config_class->{gist} if $config_class->{gist}; |
36
|
|
|
|
|
|
|
return $node_class->new(%params) ; |
37
|
764
|
100
|
33
|
|
|
2357
|
} |
38
|
764
|
|
|
|
|
25598
|
|
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.152 |
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 |