DOM/Rule/Charset.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 66.6% 2 / 3 totaltotal 98.3% 58 / 59 CC 4 SCAR 4.8
CC
4
Cov
100%
cssText
3.0
encoding
2.0
BEGIN
1.0
CRAP 1.6
« DOM/Rule/FontFace.pm ↑ Summary DOM/Array.pm »
1 package CSS::DOM::Rule::Charset;
2  
3 4 $VERSION = '0.16';
4  
5 4 ▶use warnings; no warnings qw 'utf8 parenthesis';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use CSS::DOM::Util 'escape';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶ use CSS::DOM::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 our @ISA = 'CSS::DOM::Rule';
12  
13 use constant # Don't let this conflict with the superclass.
14 4 ▶ cset => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶{ no strict 'refs'; delete ${__PACKAGE__.'::'}{cset} }
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # overrides:
18  
19 5 ▶sub type { CSS::DOM::Rule::CHARSET_RULE }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
20 sub cssText {
21 8 ▶ my $self = shift;
Subroutine cssText: called CC=3 SCAR=11.0
Pod documented
22 8 my $old;
23 8 ▶ if(defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray) 6 2 8
24 6 $old = "\@charset \""
25 . escape($self->[cset],'"') ."\";\n";
26 }
27 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 5 8
28 3 require CSS::DOM::Parser;
29 3 my $new_rule = $self->_parse(shift);
30 2 @$self[cset] = @$new_rule[cset];
31 }
32 7 $old;
33 };
34  
35  
36 # CSSCharsetRule interface:
37  
38 sub encoding {
39 27 ▶ my $old = (my $self = shift)->[cset];
Subroutine encoding: called CC=2 SCAR=6.9
Pod undocumented
40 27 ▶ @_ and $$self[cset] = shift;
Branch: 1 branch
BranchTrueFalseTotal
@_ and $self->[2] = shift() 23 4 27
41 27 $old
42 }
43  
44 4 !()__END__()!
45  
46 =head1 NAME
47  
48 CSS::DOM::Rule::FontFace - CSS @font-face rule class for CSS::DOM
49  
50 =head1 VERSION
51  
52 Version 0.16
53  
54 =head1 SYNOPSIS
55  
56 use CSS::DOM;
57 my $font_face_rule = CSS::DOM->parse(
58 '@font-face { font-family: "bm"; src: url(blackmoor.ttf) }'
59 )->cssRules->[0];
60  
61 $page_rule->style; # a CSS::DOM::Style object
62 $page_rule->style->src; # 'url(blackmoor.ttf)'
63  
64 =head1 DESCRIPTION
65  
66 This module implements CSS @font-face rules for L<CSS::DOM>. It inherits
67 from
68 L<CSS::DOM::Rule> and implements
69 the CSSFontFaceRule DOM interface.
70  
71 =head1 THE METHOD
72  
73 =over 4
74  
75 =item style
76  
77 Returns the CSS::DOM::Style object representing the declaration block
78 of this rule.
79  
80 =back
81  
82 =head1 SEE ALSO
83  
84 L<CSS::DOM>
85  
86 L<CSS::DOM::Style>
87  
88 L<CSS::DOM::Rule>
« DOM/Rule/FontFace.pm ↑ Summary DOM/Array.pm »