1Config::Model::BackendTUrsaecrkOCrodnetrr(i3bpumt)ed PerClonDfoicgu:m:eMnotdaetli:o:nBackendTrackOrder(3pm)
2
3
4
6 Config::Model::BackendTrackOrder - Track read order of elements from
7 configuration
8
10 version 2.153
11
13 # inside a backend
14 use Config::Model::BackendTrackOrder;
15
16 has tracker => (
17 is => 'ro',
18 isa => 'Config::Model::BackendTrackOrder',
19 lazy_build => 1,
20 );
21
22 sub _build_tracker {
23 my $self = shift;
24 return Config::Model::BackendTrackOrder->new(
25 backend_obj => $self,
26 node => $self->node,
27 ) ;
28 }
29
30 # register elements to record user order
31 $self->tracker->register_element('foo');
32 $self->tracker->register_element('bar');
33
34 # later, when writing data back
35 foreach my $elt ( $self->tracker->get_ordered_element_names ) {
36 # write data
37 }
38
40 This module is used by backends to record the order of the
41 configuration elements found in user file. Later these elements can be
42 written back in the file using the same order.
43
44 Data are written in canonical order if "canonical" method of the
45 "Config::Model::Instance" in instance returns true.
46
48 THe constructor accepts the following parameters:
49
50 backend_obj
51 The backend object holding this tracker (required).
52
53 node
54 The node holding the backend above
55
57 register_element
58 Register the element and keep track of the registration order during
59 initial load
60
61 Element registered after initial load (i.e . user modification) are
62 registered using canonical order.
63
64 get_ordered_element_names
65 Returns a list of elements respecting user's order.
66
67 Returns the canonical list if Instance canonical attribute is 1.
68
70 Dominique Dumont
71
73 This software is Copyright (c) 2005-2022 by Dominique Dumont.
74
75 This is free software, licensed under:
76
77 The GNU Lesser General Public License, Version 2.1, February 1999
78
79
80
81perl v5.38.0 2023-07-C2o5nfig::Model::BackendTrackOrder(3pm)