line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sympatic::Role; |
2
|
|
|
|
|
|
|
require Sympatic; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
15
|
sub import { Sympatic->import( to => (scalar caller), -class ); } |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
1; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=encoding utf8 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Sympatic::Role - A Moo::Role with all the Sympatic magic. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 STATUS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=for HTML |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
you can write this |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Sympatic::Role; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
instead of this |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Sympatic -class; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
so writing a Sympatic role C is just like |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package Flyable; |
34
|
|
|
|
|
|
|
use Sympatic::Role; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
method fly () { $self->altitude += 10 } |
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
and use it in your C class |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package Pet; |
42
|
|
|
|
|
|
|
use Sympatic; |
43
|
|
|
|
|
|
|
with 'Flyable'; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has qw( altitude is rw |
46
|
|
|
|
|
|
|
lvalue 1 |
47
|
|
|
|
|
|
|
default 0 |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has qw( name is rw ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Copyright 2018 Sympa community > |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This package is free software and is provided "as is" without express |
60
|
|
|
|
|
|
|
or implied warranty. you can redistribute it and/or modify it under the |
61
|
|
|
|
|
|
|
same terms as the Perl 5 programming language system itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 LICENCE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Copyright (C) 2017,2018 Sympa Community |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Sympatic is free software; you can redistribute it and/or |
68
|
|
|
|
|
|
|
modify it under the terms of the GNU General Public License as |
69
|
|
|
|
|
|
|
published by the Free Software Foundation; either version 2 of the |
70
|
|
|
|
|
|
|
License, or (at your option) any later version. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Sympatic is distributed in the hope that it will be useful, |
73
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
74
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
75
|
|
|
|
|
|
|
General Public License for more details. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
78
|
|
|
|
|
|
|
along with this program; if not, see . |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |