| 1 | package Form::Factory::Interface::HTML::Widget; | ||||||||||
| 2 | 1 | $Form::Factory::Interface::HTML::Widget::VERSION = '0.022'; | |||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | requires qw( render_control consume_control ); | |||||||||
| 6 | |||||||||||
| 7 | # ABSTRACT: rendering/consuming HTML controls | ||||||||||
| 8 | |||||||||||
| 9 | |||||||||||
| 10 | 1 | has alternate_renderer => ( | |||||||||
| 11 | is => 'rw', | ||||||||||
| 12 | isa => 'CodeRef', | ||||||||||
| 13 | predicate => 'has_alternate_renderer', | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | 1 | has alternate_consumer => ( | |||||||||
| 18 | is => 'rw', | ||||||||||
| 19 | isa => 'CodeRef', | ||||||||||
| 20 | predicate => 'has_alternate_consumer', | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | 6 | ▶ | sub render { | ||||||||
|
Subroutine
render: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 25 | 6 | my $self = shift; | |||||||||
| 26 | |||||||||||
| 27 | 6 | ▶ | if ($self->has_alternate_renderer) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | return $self->alternate_renderer->($self, @_); | |||||||||
| 29 | } | ||||||||||
| 30 | else { | ||||||||||
| 31 | 6 | return $self->render_control(@_); | |||||||||
| 32 | } | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | 528 | ▶ | sub consume { | ||||||||
|
Subroutine
consume: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 37 | 528 | my $self = shift; | |||||||||
| 38 | |||||||||||
| 39 | 528 | ▶ | if ($self->has_alternate_consumer) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | $self->alternate_consumer->($self, @_); | |||||||||
| 41 | } | ||||||||||
| 42 | else { | ||||||||||
| 43 | 528 | $self->consume_control(@_); | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | |||||||||||
| 48 | 1 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||