FreeHAL

 view release on metacpan or  search on metacpan

AI/FreeHAL/Config.pm  view on Meta::CPAN

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    }
    *{$caller.'::'.$opt_ref->{read_config}}  = \&AI::FreeHAL::Config::Hash::read_config;
    *{$caller.'::'.$opt_ref->{write_config}} = \&AI::FreeHAL::Config::Hash::write_config;
}
 
### [caller 0]
{
    sub serialize { return "\n" }
    sub update  {}
    sub extend  {}
    sub copy_to {}
}
 
{
    my %text_of : ATTR( :init_arg<text> );
 
    sub serialize {
        my ($self) = @_;
        return $text_of{ident $self};
    }
 
    sub append_comment {
        my ($self, $new_text) = @_;
        $text_of{ident $self} .= $new_text;
    }
 
    sub update  {}
    sub extend  {}
    sub copy_to {}
}
 
{
    my %key_of      : ATTR( :init_arg<key> :get<key> );
    my %vals_of     : ATTR;
    my %deleted_of  : ATTR;

AI/FreeHAL/Config.pm  view on Meta::CPAN

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        s/ (?!\Z) \n /\n$keyspace$sep/gxms for @vals;
 
        $serialization .= $comm || q{};
 
        $serialization .= join q{}, map {"$key$sep$_\n"} @vals;
    }
 
    return $serialization;
}
 
sub update {
    my ($self, $hash_ref, $updated_ref) = @_;
    my $ident = ident $self;
 
    my $key = $key_of{$ident};
 
    if (!exists $hash_ref->{$key}) {
        $deleted_of{$ident} = 1;
    }
    else {
        my $val = $hash_ref->{$key};

AI/FreeHAL/Config.pm  view on Meta::CPAN

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
    $self->ensure_gap() if !$is_anon;
 
    for my $comp ( @{$components_of{$ident}} ) {
        $serialization .= $comp->serialize($def_sep, $name_of{$ident});
    }
 
    return $serialization;
}
 
sub update {
    my ($self, $hash_ref, $updated_ref) = @_;
    my $ident = ident $self;
 
    if (!defined $hash_ref) {
        $deleted_of{$ident} = 1;
        return;
    }
 
    for my $comp ( @{$components_of{$ident}} ) {
        $comp->update($hash_ref, $updated_ref) or next;



( run in 0.271 second using v1.01-cache-2.11-cpan-e9199f4ba4c )