File Coverage

blib/lib/SyForm/Field.pm
Criterion Covered Total %
statement 9 10 90.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod n/a
total 12 14 85.7


line stmt bran cond sub pod time code
1             package SyForm::Field;
2             BEGIN {
3 6     6   3479 $SyForm::Field::AUTHORITY = 'cpan:GETTY';
4             }
5             # ABSTRACT: Role for fields in SyForm
6             $SyForm::Field::VERSION = '0.103';
7 6     6   43 use Moo;
  6         13  
  6         33  
8              
9             with qw(
10             MooX::Traits
11             SyForm::FieldRole::Process
12             );
13              
14             has syform => (
15             is => 'ro',
16             weak_ref => 1,
17             required => 1,
18             );
19              
20             has name => (
21             is => 'ro',
22             required => 1,
23             );
24              
25             has has_name => (
26             is => 'lazy',
27             );
28 0     0   0 sub _build_has_name { return 'has_'.($_[0]->name) }
29              
30             has label => (
31             is => 'lazy',
32             );
33              
34             sub _build_label {
35 6     6   66 my ( $self ) = @_;
36 6         19 my $name = $self->name;
37 6         15 $name =~ s/_/ /g;
38 6         24 return join(' ', map { ucfirst($_) } split(/\s+/,$name) );
  6         61  
39             }
40              
41             1;
42              
43             __END__
44              
45             =pod
46              
47             =head1 NAME
48              
49             SyForm::Field - Role for fields in SyForm
50              
51             =head1 VERSION
52              
53             version 0.103
54              
55             =head1 AUTHOR
56              
57             Torsten Raudssus <torsten@raudss.us>
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             This software is copyright (c) 2014 by Torsten Raudssus.
62              
63             This is free software; you can redistribute it and/or modify it under
64             the same terms as the Perl 5 programming language system itself.
65              
66             =cut