line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Prolix::MooseHelpers; |
2
|
|
|
|
|
|
|
# ABSTRACT: Moose helpers for App::Prolix |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
8
|
use Moose (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
5
|
1
|
|
|
1
|
|
8
|
use Moose::Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
6
|
1
|
|
|
1
|
|
66
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
232
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
9
|
|
|
|
|
|
|
with_meta => [ 'has_counter', 'has_rw', 'has_option' ]); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub has_rw { |
12
|
7
|
|
|
7
|
0
|
137
|
my ($meta, $name, %options) = @_; |
13
|
7
|
|
|
|
|
33
|
$meta->add_attribute( |
14
|
|
|
|
|
|
|
$name, |
15
|
|
|
|
|
|
|
is => 'rw', |
16
|
|
|
|
|
|
|
%options |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub has_option { |
21
|
7
|
|
|
7
|
0
|
159
|
my ($meta, $name, %options) = @_; |
22
|
7
|
|
|
|
|
38
|
$meta->add_attribute( |
23
|
|
|
|
|
|
|
$name, |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
metaclass => 'Getopt', |
26
|
|
|
|
|
|
|
%options |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub has_counter { |
31
|
2
|
|
|
2
|
0
|
46
|
my ($meta, $name, %options) = @_; |
32
|
2
|
|
|
|
|
26
|
$meta->add_attribute( |
33
|
|
|
|
|
|
|
$name, |
34
|
|
|
|
|
|
|
traits => ['Counter'], |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'Num', |
37
|
|
|
|
|
|
|
default => 0, |
38
|
|
|
|
|
|
|
handles => { |
39
|
|
|
|
|
|
|
('inc_' . $name) => 'inc', |
40
|
|
|
|
|
|
|
('dec_' . $name) => 'dec', |
41
|
|
|
|
|
|
|
('reset_' . $name) => 'reset', |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
%options |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
6; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
App::Prolix::MooseHelpers - Moose helpers for App::Prolix |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 0.03 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Gaal Yahas <gaal@forum2.org> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Google, Inc. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This is free software, licensed under: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The MIT (X11) License |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|