line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
2
|
|
|
|
|
|
|
# ABSTRACT: Observable role for MobX hashes |
3
|
|
|
|
|
|
|
$MoobX::Hash::Observable::VERSION = '0.1.2'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Moose::Role; |
6
|
3
|
|
|
3
|
|
1792
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
52
|
|
7
|
|
|
|
|
|
|
use experimental 'postderef', 'signatures'; |
8
|
3
|
|
|
3
|
|
14679
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
29
|
|
9
|
|
|
|
|
|
|
use Scalar::Util 'refaddr'; |
10
|
3
|
|
|
3
|
|
559
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
863
|
|
11
|
|
|
|
|
|
|
before [ qw/ FETCH FIRSTKEY NEXTKEY EXISTS /] => sub { |
12
|
|
|
|
|
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
push @MoobX::DEPENDENCIES, $self if $MoobX::WATCHING; |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
after [ qw/ STORE CLEAR DELETE /] => sub { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
for my $i ( values $self->value->%* ) { |
20
|
|
|
|
|
|
|
next if tied $i; |
21
|
|
|
|
|
|
|
next unless ref $i; |
22
|
|
|
|
|
|
|
my $type = ref $i; |
23
|
|
|
|
|
|
|
if( $type eq 'ARRAY' ) { |
24
|
|
|
|
|
|
|
MoobX::observable( @$i ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif( $type eq 'HASH' ) { |
27
|
|
|
|
|
|
|
MoobX::observable( %$i ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
MoobX::observable_modified( $self ); |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding UTF-8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
MoobX::Hash::Observable - Observable role for MobX hashes |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.1.2 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Role applied to L<MoobX::hash> objects to make them observables. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Used internally by L<MoobX>. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2017 by Yanick Champoux. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
63
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |