Sympatic/Role.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
import
1.0
CRAP 1.0
« Sympatic.pm ↑ Summary
1 package Sympatic::Role;
2 1 require Sympatic;
3  
4 1 ▶sub import { Sympatic->import( to => (scalar caller), -class ); }
Subroutine import: called CC=1 SCAR=0.0
5  
6 1 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 <a href="http://travis-ci.org/sympa-community/p5-sympatic/">
18 <img src="https://travis-ci.org/sympa-community/p5-sympatic.svg?branch=master">
19 </a>
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<Flyable> 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<Pet> 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 <F<sympa-developpers@listes.renater.fr>>
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 <http://www.gnu.org/licenses/>.
79  
80 =cut
« Sympatic.pm ↑ Summary