| 1 | package Chloro::Role::FormComponent; | ||
| 2 | |||
| 3 | 12 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 12 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 12 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 12 | our $VERSION = '0.07'; | |
| 8 | |||
| 9 | 12 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 12 | ▶ | use Chloro::Types qw( NonEmptyStr ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 12 | has name => ( | |
| 14 | is => 'ro', | ||
| 15 | isa => NonEmptyStr, | ||
| 16 | required => 1, | ||
| 17 | ); | ||
| 18 | |||
| 19 | 12 | has human_name => ( | |
| 20 | is => 'ro', | ||
| 21 | isa => NonEmptyStr, | ||
| 22 | lazy => 1, | ||
| 23 | builder => '_build_human_name', | ||
| 24 | ); | ||
| 25 | |||
| 26 | 4 | ▶ | sub _build_human_name { |
|
Subroutine
_build_human_name: called CC=1 SCAR=0.0
| |||
| 27 | 4 | my $self = shift; | |
| 28 | |||
| 29 | 4 | my $name = $self->name(); | |
| 30 | |||
| 31 | 4 | $name =~ s/_/ /g; | |
| 32 | |||
| 33 | 4 | return $name; | |
| 34 | } | ||
| 35 | |||
| 36 | 12 | 1; | |
| 37 | |||
| 38 | # ABSTRACT: A role for named things which are part of a form (fields and groups) | ||
| 39 | |||
| 40 | __END__ | ||