SAC/Condition/Content.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 3 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 87.1% 34 / 39 CC 4 SCAR 6.7
CC
4
Cov
87%
new
3.1
Data
2.1
BEGIN
1.0
CRAP 1.9
« SAC/Selector.pm ↑ Summary SAC/Condition/Lang.pm »
1
2 ###
3 # CSS::SAC::Condition::Content - SAC ContentConditions
4 # Robin Berjon <robin@knowscape.com>
5 # 24/02/2001
6 ###
7
8 package CSS::SAC::Condition::Content;
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::Condition);
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::Condition',
21 with => [qw(
22 _data_
23 )],
24 2 };
25 #---------------------------------------------------------------------#
26
27
28
29
30 ### Constructor #######################################################
31 # #
32 # #
33
34
35 #---------------------------------------------------------------------#
36 # CSS::SAC::Condition::Content->new($type,$data)
37 # creates a new sac ContentCondition object
38 #---------------------------------------------------------------------#
39 1 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
40 1 ▶ my $class = ref($_[0])?ref(shift):shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 1 1
41 1 my $type = shift; # should be one of the content conditions
42 1 my $data = shift;
43
44 # create a condition
45 1 my $ccond = $class->SUPER::new($type);
46
47 # add our fields
48 1 ▶ $ccond->[_data_] = $data if defined $data;
Branch: 1 branch
BranchTrueFalseTotal
if defined $data 1 0 1
49
50 1 return $ccond;
51 }
52 #---------------------------------------------------------------------#
53
54
55 # #
56 # #
57 ### Constructor #######################################################
58
59
60
61 ### Accessors #########################################################
62 # #
63 # #
64
65 # aliases
66 2 *CSS::SAC::Condition::Content::getData = \&Data;
67
68 #---------------------------------------------------------------------#
69 # my $data = $ccond->Data()
70 # $ccond->Data($data)
71 # get/set the condition's data
72 #---------------------------------------------------------------------#
73 1 ▶sub Data {
Subroutine Data: called CC=2 SCAR=7.6
Pod documented
74 1 ▶ (@_==2) ? $_[0]->[_data_] = $_[1] :
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 1 1
75 $_[0]->[_data_];
76 }
77 #---------------------------------------------------------------------#
78
79
80 # #
81 # #
82 ### Accessors #########################################################
83
84
85
86 2 1;
87
88 =pod
89
90 =head1 NAME
91
92 CSS::SAC::Condition::Content - SAC ContentConditions
93
94 =head1 SYNOPSIS
95
96 see CSS::SAC::Condition
97
98 =head1 DESCRIPTION
99
100 This is a subclass of CSS::SAC::Condition, look there for more
101 documentation. This class adds the following methods (the spec
102 equivalents are available as well, just prepend 'get'):
103
104 =head1 METHODS
105
106 =over 4
107
108 =item * CSS::SAC::Condition::Content->new($type,$data)
109
110 =item * $cond->new($type,$data)
111
112 Creates a new content condition.
113
114 =item * $ccond->Data([$data])
115
116 get/set the condition's data
117
118 =back
119
120 =head1 AUTHOR
121
122 Robin Berjon <robin@knowscape.com>
123
124 This module is licensed under the same terms as Perl itself.
125
126 =cut
127
128
« SAC/Selector.pm ↑ Summary SAC/Condition/Lang.pm »