SAC/Selector/CharacterData.pm

filter: Statementstmt 68.1% 15 / 22 Branchbran 0.0% 0 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 56.4% 22 / 39 CC 4 SCAR 17.5
CC
4
Cov
53%
new
12.0
Data
6.0
BEGIN
1.0
CRAP 5.8
« SAC/Selector/ProcessingInstruction.pm ↑ Summary SAC/LexicalUnit.pm »
1
2 ###
3 # CSS::SAC::Selector::CharacterData - SAC CharacterDataSelector
4 # Robin Berjon <robin@knowscape.com>
5 # 24/02/2001
6 ###
7
8 package CSS::SAC::Selector::CharacterData;
9 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶$VERSION = $CSS::SAC::VERSION || '0.03';
Condition50%1/2
$CSS::SAC::VERSION || '0.03'
l!l
02
MC/DC0%0/1
$CSS::SAC::VERSION || '0.03'
$CSS::SAC::VERSION
Truth table50%1/2
A
A= $CSS::SAC::VERSION
Aresult
11
00
12
13 2 ▶use base qw(CSS::SAC::Selector::Simple);
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15
16 #---------------------------------------------------------------------#
17 # build the fields for an array based object
18 #---------------------------------------------------------------------#
19 2 ▶use Class::ArrayObjects extend => {
Subroutine BEGIN: called CC=1 SCAR=0.0
20 class => 'CSS::SAC::Selector::Simple',
21 with => [qw(
22 _data_
23 )],
24 2 };
25 #---------------------------------------------------------------------#
26
27
28
29
30 ### Constructor #######################################################
31 # #
32 # #
33
34
35 #---------------------------------------------------------------------#
36 # CSS::SAC::Selector::CharacterData->new($type,$data)
37 # creates a new sac CharacterDataSelector object
38 #---------------------------------------------------------------------#
39 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
40 0 ▶ my $class = ref($_[0])?ref(shift):shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
41 0 my $type = shift; # should be one of the cdata selectors
42 0 my $data = shift;
43
44 # create a selector
45 0 my $csel = $class->SUPER::new($type);
46
47 # add our fields
48 0 ▶ $csel->[_data_] = $data if defined $data;
Branch: 1 branch
BranchTrueFalseTotal
if defined $data 0 0 0
49
50 0 return $csel;
51 }
52 #---------------------------------------------------------------------#
53
54
55 # #
56 # #
57 ### Constructor #######################################################
58
59
60
61 ### Accessors #########################################################
62 # #
63 # #
64
65 2 *CSS::SAC::Selector::CharacterData::getData = \&Data;
66
67 #---------------------------------------------------------------------#
68 # my $data = $csel->Data()
69 # $csel->Data($data)
70 # get/set the selector's cdata
71 #---------------------------------------------------------------------#
72 0 ▶sub Data {
Subroutine Data: not called CC=2 SCAR=17.9
Pod documented
73 0 ▶ (@_==2) ? $_[0]->[_data_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 0 0
74 $_[0]->[_data_];
75 }
76 #---------------------------------------------------------------------#
77
78
79 # #
80 # #
81 ### Accessors #########################################################
82
83
84
85 2 1;
86
87 =pod
88
89 =head1 NAME
90
91 CSS::SAC::Selector::CharacterData - SAC CharacterDataSelector
92
93 =head1 SYNOPSIS
94
95 see CSS::SAC::Selector
96
97 =head1 DESCRIPTION
98
99 This is a subclass of CSS::SAC::Selector::Simple, look there for more
100 documentation. This class adds the following methods (which also exist
101 in spec style, simply prepend them with 'get'):
102
103 =head1 METHODS
104
105 =over
106
107 =item * CSS::SAC::Selector::CharacterData->new($type,$data)
108 =item * $sel->new($type,$data)
109
110 Creates a new cdata selector.
111
112 =item * $csel->Data([$data])
113
114 get/set the selector's data
115
116 =back
117
118 =head1 AUTHOR
119
120 Robin Berjon <robin@knowscape.com>
121
122 This module is licensed under the same terms as Perl itself.
123
124 =cut
125
126
« SAC/Selector/ProcessingInstruction.pm ↑ Summary SAC/LexicalUnit.pm »