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
|
|
|
|
|
|
|
package Config::Model::Role::NodeLoader 2.153; # TRIAL |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Load Node element in configuration tree |
13
|
|
|
|
|
|
|
|
14
|
59
|
|
|
59
|
|
32198
|
use Mouse::Role; |
|
59
|
|
|
|
|
194
|
|
|
59
|
|
|
|
|
462
|
|
15
|
59
|
|
|
59
|
|
18980
|
use strict; |
|
59
|
|
|
|
|
205
|
|
|
59
|
|
|
|
|
1261
|
|
16
|
59
|
|
|
59
|
|
375
|
use warnings; |
|
59
|
|
|
|
|
211
|
|
|
59
|
|
|
|
|
1710
|
|
17
|
59
|
|
|
59
|
|
368
|
use Carp; |
|
59
|
|
|
|
|
172
|
|
|
59
|
|
|
|
|
3846
|
|
18
|
59
|
|
|
59
|
|
894
|
use 5.10.0; |
|
59
|
|
|
|
|
292
|
|
19
|
|
|
|
|
|
|
|
20
|
59
|
|
|
59
|
|
482
|
use Mouse::Util; |
|
59
|
|
|
|
|
197
|
|
|
59
|
|
|
|
|
548
|
|
21
|
59
|
|
|
59
|
|
5565
|
use Log::Log4perl qw(get_logger :levels); |
|
59
|
|
|
|
|
207
|
|
|
59
|
|
|
|
|
484
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $load_logger = get_logger("TreeLoad"); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub load_node { |
26
|
785
|
|
|
785
|
1
|
4201
|
my ($self, %params) = @_ ; |
27
|
|
|
|
|
|
|
|
28
|
785
|
|
|
|
|
1817
|
my $config_class_name = $params{config_class_name}; |
29
|
785
|
|
|
|
|
4221
|
my $config_class = $self->config_model->get_model_clone($config_class_name) ; |
30
|
785
|
|
100
|
|
|
63224
|
my $node_class = $config_class->{class} || 'Config::Model::Node'; |
31
|
785
|
|
|
|
|
6518
|
$load_logger->debug("Loading $config_class_name ". $self->location . " with $node_class"); |
32
|
785
|
|
|
|
|
9767
|
Mouse::Util::load_class($node_class); |
33
|
|
|
|
|
|
|
|
34
|
785
|
50
|
|
|
|
15529
|
if (delete $params{check}) { |
35
|
0
|
|
|
|
|
0
|
carp "load_node; drop check param. Better let node query the instance"; |
36
|
|
|
|
|
|
|
} |
37
|
785
|
100
|
33
|
|
|
2507
|
$params{gist} //= $config_class->{gist} if $config_class->{gist}; |
38
|
785
|
|
|
|
|
24987
|
return $node_class->new(%params) ; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Config::Model::Role::NodeLoader - Load Node element in configuration tree |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 2.153 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$self->load_node( config_class_name => "...", %other_args); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Role used to load a node element using L<Config::Model::Node> (default behavior). |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
If the config class overrides the default implementation, ( C<class> parameter ), the |
66
|
|
|
|
|
|
|
override class is loaded and used to create the node. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 METHODS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 load_node |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Creates a node object using all the named parameters passed to load_node. One of these |
73
|
|
|
|
|
|
|
parameter must be C<config_class_name> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Dominique Dumont |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This software is Copyright (c) 2005-2022 by Dominique Dumont. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This is free software, licensed under: |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |