line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MoobX::Hash; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: MoobX wrapper for hash variables |
4
|
|
|
|
|
|
|
$MoobX::Hash::VERSION = '0.1.0'; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1699
|
use Moose; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
14090
|
use experimental 'postderef'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
19
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has value => ( |
11
|
|
|
|
|
|
|
traits => [ 'Hash' ], |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
default => sub { +{} }, |
14
|
|
|
|
|
|
|
handles => { |
15
|
|
|
|
|
|
|
FETCH => 'get', |
16
|
|
|
|
|
|
|
STORE => 'set', |
17
|
|
|
|
|
|
|
CLEAR => 'clear', |
18
|
|
|
|
|
|
|
DELETE => 'delete', |
19
|
|
|
|
|
|
|
EXISTS => 'exists', |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub BUILD_ARGS { |
24
|
0
|
|
|
0
|
0
|
0
|
my( $class, @args ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
0
|
unshift @args, 'value' if @args == 1; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
return { @args } |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub TIEHASH { |
32
|
5
|
|
|
5
|
|
35
|
(shift)->new( value => +{ @_ } ) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
11
|
|
|
11
|
|
38
|
sub FIRSTKEY { my $self = shift; my $a = scalar keys $self->value->%*; each $self->value->%* } |
|
11
|
|
|
|
|
238
|
|
|
11
|
|
|
|
|
201
|
|
36
|
11
|
|
|
11
|
|
30
|
sub NEXTKEY { my $self = shift; each $self->value->%* } |
|
11
|
|
|
|
|
205
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding UTF-8 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
MoobX::Hash - MoobX wrapper for hash variables |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 VERSION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
version 0.1.0 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Class implementing a C<tie>ing interface for hash variables. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Used internally by L<MoobX>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Yanick Champoux. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
71
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |