Widget/BlockContainer.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 52 CC 6 SCAR 32.6
CC
6
Cov
0%
_build_element
42.0
BEGIN
2.0
BEGIN
2.0
CRAP 26.0
1 package HTML::Widget::BlockContainer;
2  
3 use warnings;
4 use strict;
5 use base 'HTML::Widget::Container';
6 use Carp qw/croak/;
7  
8 __PACKAGE__->mk_accessors(qw/content pre_content post_content wrap_sub/);
9  
10 =head1 NAME
11  
12 HTML::Widget::BlockContainer - Block Container
13  
14 =head1 DESCRIPTION
15  
16 A Container for Block elements. See L<HTML::Widget::Element::Block>
17 and L<HTML::Widget::Container>.
18  
19 =head1 METHODS
20  
21 =cut
22  
23 sub _build_element {
24 my ( $self, $element ) = @_;
25  
26 return () unless $element;
27 if ( ref $element eq 'ARRAY' ) {
28 croak("Not expecting an array");
29 }
30  
31 my $wrap_sub = $self->wrap_sub || sub { return (@_); };
32  
33 my $e = $element->clone;
34 $e->push_content( @{ $self->pre_content } ) if $self->pre_content;
35 $e->push_content( map { &$wrap_sub( $_->as_list ); } @{ $self->content } );
36 $e->push_content( @{ $self->post_content } ) if $self->post_content;
37  
38 if ( $self->label ) {
39 my $l = $self->label->clone;
40 $e = $l->push_content($e);
41 }
42  
43 return ($e);
44 }
45  
46 =head1 AUTHOR
47  
48 Michael Gray, C<mjg@cpan.org>
49  
50 =cut
51  
52 1;