File Coverage

lib/MooseX/Has/Sugar/Minimal.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1 2     2   67355 use 5.006; # pragmas
  2         7  
  2         77  
2 2     2   11 use warnings;
  2         5  
  2         61  
3 2     2   10 use strict;
  2         12  
  2         186  
4              
5             package MooseX::Has::Sugar::Minimal;
6              
7             our $VERSION = '1.000004';
8              
9             # ABSTRACT: Less Sugary Syntax for moose 'has' fields
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 2         33 use Sub::Exporter::Progressive -setup => {
14             exports => [ 'ro', 'rw', 'bare', ],
15             groups => {
16             is => [ 'ro', 'rw', 'bare', ],
17             default => [ '-all', ],
18             },
19 2     2   849 };
  2         1148  
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35              
36              
37             sub bare() {
38 1     1 1 736 return ('bare');
39             }
40              
41              
42              
43              
44              
45              
46              
47             sub ro() {
48 2     2 1 4891 return ('ro');
49             }
50              
51              
52              
53              
54              
55              
56              
57             sub rw() {
58 1     1 1 1282 return ('rw');
59             }
60              
61             1;
62              
63             __END__
64              
65             =pod
66              
67             =encoding UTF-8
68              
69             =head1 NAME
70              
71             MooseX::Has::Sugar::Minimal - Less Sugary Syntax for moose 'has' fields
72              
73             =head1 VERSION
74              
75             version 1.000004
76              
77             =head1 SYNOPSIS
78              
79             This is a legacy variant of L<Sugar|MooseX::Has::Sugar> which only exports C<ro>
80             and C<rw> functions, the way L<MooseX::Has::Sugar|MooseX::Has::Sugar> used to with C<:is>;
81              
82             use MooseX::Types::Moose qw( Str );
83             use MooseX::Has::Sugar::Minimal;
84              
85             has foo => (
86             isa => Str,
87             is => ro,
88             required => 1,
89             );
90             has bar => (
91             isa => Str,
92             is => rw,
93             lazy_build => 1,
94             );
95              
96             All functions are exported by L<The Sub::Exporter Module|Sub::Exporter>.
97              
98             =head1 EXPORT GROUPS
99              
100             =head2 C<:default>
101              
102             Exports L</:is>
103              
104             =head2 C<:is>
105              
106             Exports L</bare>, L</ro>, L</rw>
107              
108             =head1 EXPORTED FUNCTIONS
109              
110             =head2 C<bare>
111              
112             returns C<('bare')>
113              
114             =head2 C<ro>
115              
116             returns C<('ro')>
117              
118             =head2 C<rw>
119              
120             returns C<('rw')>
121              
122             =head1 CONFLICTS
123              
124             =head2 MooseX::Has::Sugar
125              
126             =head2 MooseX::Has::Sugar::Saccharin
127              
128             This module is not intended to be used in conjunction with
129             L<::Sugar|MooseX::Has::Sugar> or L<::Sugar::Saccharin|MooseX::Has::Sugar::Saccharin>.
130              
131             We all export L</ro> and L</rw> in different ways.
132              
133             If you do however want to use them in conjunction, specific imports must
134             be done on L<MooseX::Has::Sugar's|MooseX::Has::Sugar> side to stop it exporting different
135             ro/rw. Any of the below should be fine.
136              
137             use MooseX::Has::Sugar::Minimal;
138             use MooseX::Has::Sugar qw( :attrs );
139              
140             has foo =>( is => rw , lazy_build );
141              
142             use MooseX::Has::Sugar::Minimal;
143             use MooseX::Has::Sugar qw( lazy_build );
144              
145             has foo =>( is => rw , lazy_build );
146              
147             =head1 AUTHOR
148              
149             Kent Fredric <kentnl at cpan.org>
150              
151             =head1 COPYRIGHT AND LICENSE
152              
153             This software is copyright (c) 2014 by Kent Fredric.
154              
155             This is free software; you can redistribute it and/or modify it under
156             the same terms as the Perl 5 programming language system itself.
157              
158             =cut