| 1 | package Catalyst::Controller::FormBuilder; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use base qw/Catalyst::Controller/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use MRO::Compat; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | our $VERSION = "0.06"; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | __PACKAGE__->mk_accessors(qw/_fb_setup/); | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | my $self = $class->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | $self->__setup(); | |||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | sub __setup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__setup: called CC=9 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | my $class = ref $self; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | ▶ | my $config = $self->config->{'Controller::FormBuilder'} || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->config->{'Controller::FormBuilder'} || {}
MC/DC100%1/1
$self->config->{'Controller::FormBuilder'} || {}
$self->config->{'Controller::FormBuilder'}
Truth table100%2/2
A
A= $self->config->{'Controller::FormBuilder'}
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | ▶ | my $tmpl_type = $config->{template_type} || "TT"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$config->{'template_type'} || 'TT'
MC/DC0%0/1
$config->{'template_type'} || 'TT'
$config->{'template_type'}
Truth table50%1/2
A
A= $config->{'template_type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 6 | ▶ | my $method = $config->{method_name} || 'formbuilder'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$config->{'method_name'} || 'formbuilder'
MC/DC100%1/1
$config->{'method_name'} || 'formbuilder'
$config->{'method_name'}
Truth table100%2/2
A
A= $config->{'method_name'}
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | my $action = $config->{action} | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | || "Catalyst::Controller::FormBuilder::Action::$tmpl_type"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$config->{'action'} || "Catalyst::Controller::FormBuilder::Action::$tmpl_type"
MC/DC0%0/1
$config->{'action'} || "Catalyst::Controller::FormBuilder::Action::$tmpl_type"
$config->{'action'}
Truth table50%1/2
A
A= $config->{'action'}
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | $self->_fb_setup( | ||||||||||||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | method_name => $method, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | stash_name => $config->{stash_name} || 'formbuilder', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | obj_name => $config->{obj_name} || 'FormBuilder', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | action => $action, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | attr_name => $config->{attr_name} || 'Form', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | source_type => $config->{source_type} || undef, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 6 | ▶ | template_type => $tmpl_type, | ||||||||||||||||||||||||||||||||||||||||
|
Condition62%5/8
$config->{'stash_name'} || 'formbuilder'
$config->{'obj_name'} || 'FormBuilder'
$config->{'attr_name'} || 'Form'
$config->{'source_type'} || undef
MC/DC100%1/1
$config->{'stash_name'} || 'formbuilder'
$config->{'stash_name'}
MC/DC0%0/1
$config->{'obj_name'} || 'FormBuilder'
$config->{'obj_name'}
MC/DC0%0/1
$config->{'attr_name'} || 'Form'
$config->{'attr_name'}
MC/DC0%0/1
$config->{'source_type'} || undef
$config->{'source_type'}
Truth table100%2/2
A
A= $config->{'stash_name'}
Truth table50%1/2
A
A= $config->{'obj_name'}
Truth table50%1/2
A
A= $config->{'attr_name'}
Truth table50%1/2
A
A= $config->{'source_type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 6 | *{"$class\::$method"} = $class->make_accessor($method); | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 20 | ▶ | sub _formbuilder { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_formbuilder: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 20 | my $method = $self->_fb_setup->{method_name}; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 20 | $self->$method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 51 | ▶ | sub create_action { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_action: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 51 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 51 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 51 | my $attr_name = $self->_fb_setup->{attr_name}; | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 51 | ▶ | if ( exists $args{attributes}{$attr_name} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 9 | $args{_attr_params} = delete $args{attributes}{$attr_name}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | ▶ | if ( my $source_type = $self->_fb_setup->{source_type} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $args{_source_type} = $source_type; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | push @{ $args{attributes}{ActionClass} }, $self->_fb_setup->{action}; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 51 | $self->SUPER::create_action(%args); | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||||||||||||||||||||||||