File Coverage

blib/lib/Form/Factory/Control/Role/Labeled.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 10 10 100.0


line stmt bran cond sub pod time code
1             package Form::Factory::Control::Role::Labeled;
2             $Form::Factory::Control::Role::Labeled::VERSION = '0.022';
3 1     1   526 use Moose::Role;
  1         2  
  1         6  
4              
5             # ABSTRACT: labeled controls
6              
7              
8             has label => (
9             is => 'ro',
10             isa => 'Str',
11             required => 1,
12             builder => '_build_label',
13             lazy => 1,
14             );
15              
16             sub _build_label {
17 31     31   47 my $self = shift;
18 31         923 my $label = $self->name;
19 31         89 $label =~ s/_/ /g;
20 31         200 $label =~ s/\b(\w)/\U$1\E/g;
21 31         988 return $label;
22             }
23              
24             1;
25              
26             __END__
27              
28             =pod
29              
30             =encoding UTF-8
31              
32             =head1 NAME
33              
34             Form::Factory::Control::Role::Labeled - labeled controls
35              
36             =head1 VERSION
37              
38             version 0.022
39              
40             =head1 DESCRIPTION
41              
42             Implemented by any control with a label.
43              
44             =head1 ATTRIBUTES
45              
46             =head2 label
47              
48             The label. By default it is created from the control's name.
49              
50             =head1 AUTHOR
51              
52             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
53              
54             =head1 COPYRIGHT AND LICENSE
55              
56             This software is copyright (c) 2015 by Qubling Software LLC.
57              
58             This is free software; you can redistribute it and/or modify it under
59             the same terms as the Perl 5 programming language system itself.
60              
61             =cut