SAC/Selector/ProcessingInstruction.pm

filter: Statementstmt 61.5% 16 / 26 Branchbran 0.0% 0 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 57.1% 4 / 7 Podpod 100% 3 / 3 totaltotal 51.0% 24 / 47 CC 5 SCAR 17.6
CC
5
Cov
47%
new
12.0
Target
6.0
Data
6.0
CRAP 5.8
« SAC.pm ↑ Summary SAC/Selector/CharacterData.pm »
1
2 ###
3 # CSS::SAC::Selector::ProcessingInstruction - SAC ProcessingInstructionSelector
4 # Robin Berjon <robin@knowscape.com>
5 # 24/02/2001
6 ###
7
8 package CSS::SAC::Selector::ProcessingInstruction;
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 _target_
23 _data_
24 )],
25 2 };
26 #---------------------------------------------------------------------#
27
28
29
30
31 ### Constructor #######################################################
32 # #
33 # #
34
35
36 #---------------------------------------------------------------------#
37 # CSS::SAC::Selector::ProcessingInstruction->new($type,$target,$data)
38 # creates a new sac ProcessingInstructionSelector object
39 #---------------------------------------------------------------------#
40 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
41 0 ▶ my $class = ref($_[0])?ref(shift):shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
42 0 my $type = shift;
43 0 my $target = shift;
44 0 my $data = shift;
45
46 # create a selector
47 0 my $psel = $class->SUPER::new($type);
48
49 # add our fields
50 0 $psel->[_target_] = $target;
51 0 ▶ $psel->[_data_] = $data if defined $data;
Branch: 1 branch
BranchTrueFalseTotal
if defined $data 0 0 0
52
53 0 return $psel;
54 }
55 #---------------------------------------------------------------------#
56
57
58 # #
59 # #
60 ### Constructor #######################################################
61
62
63
64 ### Accessors #########################################################
65 # #
66 # #
67
68
69 2 *CSS::SAC::Selector::ProcessingInstruction::getTarget = \&Target;
70 2 *CSS::SAC::Selector::ProcessingInstruction::getData = \&Data;
71
72 #---------------------------------------------------------------------#
73 # my $target = $psel->Target()
74 # $psel->Target($target)
75 # get/set the selector's target
76 #---------------------------------------------------------------------#
77 0 ▶sub Target {
Subroutine Target: not called CC=2 SCAR=17.9
Pod documented
78 0 ▶ (@_==2) ? $_[0]->[_target_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 0 0
79 $_[0]->[_target_];
80 }
81 #---------------------------------------------------------------------#
82
83
84 #---------------------------------------------------------------------#
85 # my $data = $psel->Data()
86 # $psel->Data($data)
87 # get/set the selector's data
88 #---------------------------------------------------------------------#
89 0 ▶sub Data {
Subroutine Data: not called CC=2 SCAR=17.9
Pod documented
90 0 ▶ (@_==2) ? $_[0]->[_data_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 0 0
91 $_[0]->[_data_];
92 }
93 #---------------------------------------------------------------------#
94
95
96 # #
97 # #
98 ### Accessors #########################################################
99
100
101
102 2 1;
103
104 =pod
105
106 =head1 NAME
107
108 CSS::SAC::Selector::ProcessingInstruction - SAC ProcessingInstructionSelector
109
110 =head1 SYNOPSIS
111
112 see CSS::SAC::Selector
113
114 =head1 DESCRIPTION
115
116 This is a subclass of CSS::SAC::Selector::Simple, look there for more
117 documentation. This class adds the following methods (which also exist
118 in spec style, simply prepend them with 'get'):
119
120 =head1 METHODS
121
122 =over
123
124 =item * CSS::SAC::Selector::ProcessingInstruction->new($type,$target,$data)
125 =item * $psel->new($type,$target,$data)
126
127 Creates a new pi selector.
128
129 =item * $psel->Target([$target])
130
131 get/set the selector's target
132
133 =item * $psel->Data([$data])
134
135 get/set the selector's data
136
137 =back
138
139 =head1 AUTHOR
140
141 Robin Berjon <robin@knowscape.com>
142
143 This module is licensed under the same terms as Perl itself.
144
145 =cut
146
147
« SAC.pm ↑ Summary SAC/Selector/CharacterData.pm »