File Coverage

blib/lib/MoobX/Scalar/Observable.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             our $AUTHORITY = 'cpan:YANICK';
2             # ABSTRACT: Observable role for MobX scalars
3             $MoobX::Scalar::Observable::VERSION = '0.1.1';
4              
5             use 5.20.0;
6 6     6   3081  
  6         20  
7             use Moose::Role;
8 6     6   41  
  6         10  
  6         124  
9             use Scalar::Util 'refaddr';
10 6     6   29069  
  6         15  
  6         1077  
11             before 'FETCH' => sub {
12             my $self = shift;
13             push @MoobX::DEPENDENCIES, $self if $MoobX::WATCHING;
14             };
15              
16             after 'STORE' => sub {
17             my $self = shift;
18            
19             MoobX::observable_ref($self->value) if ref $self->value;
20             MoobX::observable_modified( $self );
21             };
22              
23             1;
24              
25              
26             =pod
27              
28             =encoding UTF-8
29              
30             =head1 NAME
31              
32             MoobX::Scalar::Observable - Observable role for MobX scalars
33              
34             =head1 VERSION
35              
36             version 0.1.1
37              
38             =head1 DESCRIPTION
39              
40             Role applied to L<MoobX::Scalar> objects to make them observables.
41              
42             Used internally by L<MoobX>.
43              
44             =head1 AUTHOR
45              
46             Yanick Champoux <yanick@cpan.org>
47              
48             =head1 COPYRIGHT AND LICENSE
49              
50             This software is copyright (c) 2022, 2017 by Yanick Champoux.
51              
52             This is free software; you can redistribute it and/or modify it under
53             the same terms as the Perl 5 programming language system itself.
54              
55             =cut