lib/XML/Schema/Handler.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 62.5% 5 / 8 Conditioncond 58.3% 7 / 12 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 75.0% 6 / 8 Podpod 25.0% 1 / 4 totaltotal 68.1% 47 / 69 CC 7 SCAR 15.2
CC
7
Cov
77%
init
7.9
name
2.0
ID
2.0
CRAP 4.6
« lib/XML/Schema/Content.pm ↑ Summary lib/XML/Schema/Factory.pm »
1 #============================================================= -*-perl-*-
2 #
3 # XML::Schema::Handler
4 #
5 # DESCRIPTION
6 # Module implementing a base class parser handler.
7 #
8 # AUTHOR
9 # Andy Wardley <abw@kfs.org>
10 #
11 # COPYRIGHT
12 # Copyright (C) 2001 Canon Research Centre Europe Ltd.
13 # All Rights Reserved.
14 #
15 # This module is free software; you can redistribute it and/or
16 # modify it under the same terms as Perl itself.
17 #
18 # REVISION
19 # $Id: Handler.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $
20 #
21 #========================================================================
22  
23 package XML::Schema::Handler;
24  
25 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use XML::Schema::Scheduler;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use base qw( XML::Schema::Scheduler );
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL );
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 2 $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
31 2 ▶$DEBUG = 0 unless defined $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $XML::Schema::Handler::DEBUG 2 0 2
32 2 $ERROR = '';
33  
34 #@MANDATORY = qw( type );
35 2 @OPTIONAL = qw( name type );
36  
37  
38 #------------------------------------------------------------------------
39 # init()
40 #------------------------------------------------------------------------
41  
42 5 ▶sub init {
Subroutine init: called CC=7 SCAR=20.6
Pod documented
43 5 my ($self, $config) = @_;
44 5 my ($name, $value);
45  
46 5 ▶ $self->init_scheduler($config)
Branch: 1 branch
BranchTrueFalseTotal
$self->init_scheduler($config) or return 5 0 5
47 || return;
48  
49 my ($mand, $option)
50 5 = @{ $self->_baseargs( qw( @MANDATORY @OPTIONAL ) ) };
51  
52 5 ▶ $self->_mandatory($mand, $config)
Branch: 1 branch
BranchTrueFalseTotal
if @$mand 4 1 5
Condition80%4/5
@$mand && ($self->_mandatory($mand, $config) || (return))
!ll
140
$self->_mandatory($mand, $config) or return
l!l
31
MC/DC0%0/2
@$mand && ($self->_mandatory($mand, $config) || (return))
@$mand $self->_mandatory($mand, $config)
Truth table66%2/3
A && B
A= @$mandB= $self->_mandatory($mand, $config)
ABresult
0X0
100
111
53 || return if @$mand;
54  
55 4 ▶ $self->_optional($option, $config)
Branch: 1 branch
BranchTrueFalseTotal
if @$option 4 0 4
Condition40%2/5
@$option && ($self->_optional($option, $config) || (return))
!ll
040
$self->_optional($option, $config) or return
l!l
40
MC/DC0%0/2
@$option && ($self->_optional($option, $config) || (return))
@$option $self->_optional($option, $config)
Truth table0%0/3
A && B
A= @$optionB= $self->_optional($option, $config)
ABresult
0X0
100
111
56 || return if @$option;
57  
58 4 ▶ $self->{ name } ||= '<anon>';
Condition50%1/2
$self->{"name"} ||= "<anon>"
l!l
04
MC/DC0%0/1
$self->{"name"} ||= "<anon>"
$self->{"name"}
Truth table50%1/2
A
A= $self->{"name"}
Aresult
11
00
59  
60 4 return $self;
61 }
62  
63  
64 #------------------------------------------------------------------------
65 # accessor methods
66 #------------------------------------------------------------------------
67  
68 2 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
69 2 my $self = shift;
70 2 return $self->{ type };
71 }
72  
73 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
74 0 my $self = shift;
75 0 return $self->{ name };
76 }
77  
78  
79 0 ▶sub ID {
Subroutine ID: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my $self = shift;
81 0 return "Handler[$self->{ name }]";
82 }
83  
84 2 1;
85  
86 __END__
« lib/XML/Schema/Content.pm ↑ Summary lib/XML/Schema/Factory.pm »