« blib/lib/Rose/HTML/Form/Field/Time/Split/HourMinuteSecond.pm
↑ Summary
blib/lib/Rose/HTML/Form/Field/DateTime/Split/MDYHMS.pm »
| 1 | package Rose::HTML::Script; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | ▶ | use base 'Rose::HTML::Object'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | our $VERSION = '0.606'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | use Rose::Class::MakeMethods::Generic | ||||||||||||||||||||
| 10 | 2 | ▶ | ( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 2 | inheritable_scalar => 'default_support_older_browsers', | |||||||||||||||||||
| 12 | 2 | ); | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 2 | __PACKAGE__->default_support_older_browsers(1); | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 2 | __PACKAGE__->add_valid_html_attrs | |||||||||||||||||||
| 17 | ( | ||||||||||||||||||||
| 18 | 'charset', # %Charset; #IMPLIED -- char encoding of linked resource | ||||||||||||||||||||
| 19 | 'type', # %ContentType; #REQUIRED -- content type of script language | ||||||||||||||||||||
| 20 | 'src', # %URI; #IMPLIED -- URI for an external script | ||||||||||||||||||||
| 21 | 'defer', # (defer) #IMPLIED -- UA may defer execution of script | ||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | __PACKAGE__->add_required_html_attrs( | |||||||||||||||||||
| 25 | { | ||||||||||||||||||||
| 26 | type => 'text/javascript', | ||||||||||||||||||||
| 27 | }); | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 2 | __PACKAGE__->add_boolean_html_attrs | |||||||||||||||||||
| 30 | ( | ||||||||||||||||||||
| 31 | 'defer', | ||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 7 | ▶ | sub src { shift->html_attr('src', @_) } | ||||||||||||||||||
|
Subroutine
src: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 35 | 1 | ▶ | sub type { shift->html_attr('type', @_) } | ||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | sub support_older_browsers | ||||||||||||||||||||
| 38 | 6 | ▶ | { | ||||||||||||||||||
|
Subroutine
support_older_browsers: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 39 | 6 | my($self) = shift; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 6 | ▶ | return $self->{'support_older_browsers'} = $_[0] ? 1 : 0 if(@_); | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 4 | ▶ | unless(defined $self->{'support_older_browsers'}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 44 | { | ||||||||||||||||||||
| 45 | 2 | return $self->{'support_older_browsers'} = | |||||||||||||||||||
| 46 | (ref($self))->default_support_older_browsers; | ||||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 2 | return $self->{'support_older_browsers'}; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 0 | ▶ | sub html_element { 'script' } | ||||||||||||||||||
|
Subroutine
html_element: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 53 | 0 | ▶ | sub xhtml_element { 'script' } | ||||||||||||||||||
|
Subroutine
xhtml_element: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | sub script | ||||||||||||||||||||
| 56 | 7 | ▶ | { | ||||||||||||||||||
|
Subroutine
script: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 57 | 7 | my($self) = shift; | |||||||||||||||||||
| 58 | 7 | ▶ | $self->children(@_) if(@_); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 7 | return join('', map { $_->html } $self->children) | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 2 | *contents = \&script; | |||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | sub xhtml_contents_escaped | ||||||||||||||||||||
| 65 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
xhtml_contents_escaped: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||
| 66 | 2 | my($self) = shift; | |||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 2 | my $contents = $self->contents; | |||||||||||||||||||
| 69 | 2 | ▶ | return $contents unless($contents =~ /\S/); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 2 | for($contents) { s/\A\n//; s/\n\Z// } | |||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 2 | ▶ | if($self->support_older_browsers) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 74 | { | ||||||||||||||||||||
| 75 | 1 | return "<!--//--><![CDATA[//><!--\n$contents\n//--><!]]>"; | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 1 | return "\n//<![CDATA[\n$contents\n//]]>\n"; | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | sub html_contents_escaped | ||||||||||||||||||||
| 82 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
html_contents_escaped: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 83 | 2 | my($self) = shift; | |||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 2 | my $contents = $self->contents; | |||||||||||||||||||
| 86 | 2 | ▶ | return $contents unless($contents =~ /\S/); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 2 | for($contents) { s/\A\n//; s/\n\Z// } | |||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 2 | return "\n<!--\n$contents\n// -->\n"; | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | sub html_tag | ||||||||||||||||||||
| 94 | 3 | ▶ | { | ||||||||||||||||||
|
Subroutine
html_tag: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 95 | 3 | my($self) = shift; | |||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | 3 | ▶ | if(length($self->src || '')) | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->src || ''
MC/DC100%1/1
$self->src || ''
$self->src
Truth table100%2/2
A
A= $self->src
| |||||||||||||||||||||
| 98 | { | ||||||||||||||||||||
| 99 | 2 | ▶ | no warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 100 | 1 | return '<script' . $self->html_attrs_string . '></script>'; | |||||||||||||||||||
| 101 | } | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 2 | ▶ | no warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 104 | 2 | return '<script' . $self->html_attrs_string . '>' . | |||||||||||||||||||
| 105 | $self->html_contents_escaped . | ||||||||||||||||||||
| 106 | '</script>'; | ||||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | sub xhtml_tag | ||||||||||||||||||||
| 110 | 3 | ▶ | { | ||||||||||||||||||
|
Subroutine
xhtml_tag: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 111 | 3 | my($self) = shift; | |||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 3 | ▶ | if(length($self->src || '')) | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->src || ''
MC/DC100%1/1
$self->src || ''
$self->src
Truth table100%2/2
A
A= $self->src
| |||||||||||||||||||||
| 114 | { | ||||||||||||||||||||
| 115 | 2 | ▶ | no warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 116 | 1 | return '<script' . $self->xhtml_attrs_string . ' />'; | |||||||||||||||||||
| 117 | } | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 2 | ▶ | no warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 120 | 2 | return '<script' . $self->xhtml_attrs_string . '>' . | |||||||||||||||||||
| 121 | $self->xhtml_contents_escaped . | ||||||||||||||||||||
| 122 | '</script>'; | ||||||||||||||||||||
| 123 | } | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | 2 | 1; | |||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | __END__ | ||||||||||||||||||||