Factory/Interface.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 94.5% 35 / 37 CC 3 SCAR 3.8
CC
3
Cov
93%
new_action
2.0
new_control
2.0
BEGIN
1.0
CRAP 1.5
« Factory/Feature/Control/Trim.pm ↑ Summary Factory/Feature.pm »
1 package Form::Factory::Interface;
2 1 $Form::Factory::Interface::VERSION = '0.022';
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Class::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Form::Factory::Stasher::Memory;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 requires qw( render_control consume_control );
10  
11 # ABSTRACT: Role for form interface implementations
12  
13  
14 has stasher => (
15 is => 'ro',
16 does => 'Form::Factory::Stasher',
17 required => 1,
18 14 ▶ default => sub { Form::Factory::Stasher::Memory->new },
Subroutine __ANON__: called CC=1 SCAR=0.0
19 1 handles => [ qw( stash unstash ) ],
20 );
21  
22  
23 14 ▶sub new_action {
Subroutine new_action: called CC=2 SCAR=7.1
Pod documented
24 14 my ($self, $class_name, $args) = @_;
25  
26 14 ▶ Class::Load::load_class($class_name)
Branch: 1 branch
BranchTrueFalseTotal
Class::Load::load_class($class_name) or Carp::croak("cannot load ${class_name}: $@") 14 0 14
27 or Carp::croak("cannot load $class_name: $@");
28  
29 14 return $class_name->new( %$args, form_interface => $self );
30 }
31  
32  
33 78 ▶sub new_control {
Subroutine new_control: called CC=2 SCAR=7.0
Pod documented
34 78 my ($self, $name, $args) = @_;
35  
36 78 my $class_name = Form::Factory->control_class($name);
37 78 ▶ return unless $class_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $class_name 0 78 78
38  
39 78 return $class_name->new($args);
40 }
41  
42  
43 1 1;
44  
45 __END__
« Factory/Feature/Control/Trim.pm ↑ Summary Factory/Feature.pm »