Widget/Element/Span.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 46 CC 4 SCAR 24.0
CC
4
Cov
0%
containerize
20.0
new
2.0
BEGIN
2.0
CRAP 11.0
1 package HTML::Widget::Element::Span;
2  
3 use warnings;
4 use strict;
5 use base 'HTML::Widget::Element';
6  
7 __PACKAGE__->mk_accessors(qw/content/);
8  
9 =head1 NAME
10  
11 HTML::Widget::Element::Span - Span Element
12  
13 =head1 SYNOPSIS
14  
15 my $e = $widget->element( 'Span', 'foo' );
16 $e->content('bar');
17  
18 =head1 DESCRIPTION
19  
20 Span Element.
21  
22 =head1 METHODS
23  
24 =head2 content
25  
26 C<content()> can contain a string, an
27 L<HTML::Element|HTML::Element> object, or an array-ref of
28 L<HTML::Element|HTML::Element> objects.
29  
30 =head2 containerize
31  
32 =cut
33  
34 sub containerize {
35 my ( $self, $w ) = @_;
36  
37 my $content = $self->content;
38 $self->attributes->{class} ||= 'span';
39 my $e = HTML::Element->new( 'span', id => $self->id($w) );
40 my @content
41 = ( $content && ref($content) eq 'ARRAY' ) ? @$content : ($content)
42 if defined $content;
43 $e->push_content(@content) if @content;
44 $e->attr( $_ => ${ $self->attributes }{$_} )
45 for ( keys %{ $self->attributes } );
46  
47 return $self->container( { element => $e } );
48 }
49  
50 =head2 new
51  
52 Sets L<HTML::Widget::Element/allow_filter> to false, so that filters added
53 by C<< $widget->filter_all >> won't be applied to Span elements.
54  
55 Sets L<HTML::Widget::Element/allow_constraint> to false, so that constraints
56 added by C<< $widget->constraint_all >> won't be applied to Span elements.
57  
58 =cut
59  
60 sub new {
61 my $self = shift->NEXT::new(@_);
62  
63 $self->allow_filter(0)->allow_constraint(0);
64  
65 return $self;
66 }
67  
68 =head1 SEE ALSO
69  
70 L<HTML::Widget::Element>
71  
72 =head1 AUTHOR
73  
74 Sebastian Riedel, C<sri@oook.de>
75  
76 =head1 LICENSE
77  
78 This library is free software, you can redistribute it and/or modify it under
79 the same terms as Perl itself.
80  
81 =cut
82  
83 1;