lib/XML/Schema/Type.pm

filter: Statementstmt 100% 37 / 37 Branchbran 50.0% 3 / 6 Conditioncond 20.0% 1 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 25.0% 1 / 4 totaltotal 81.2% 52 / 64 CC 4 SCAR 7.8
CC
4
Cov
85%
init
4.8
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« lib/XML/Schema/Facet/Builtin.pm ↑ Summary lib/XML/Schema/Facet.pm »
1 #============================================================= -*-perl-*-
2 #
3 # XML::Schema::Type.pm
4 #
5 # DESCRIPTION
6 # Module implementing a base class for XML Schema datatypes. This
7 # is the ur-type, instantiated within a schema as the ever-present
8 # anyType.
9 #
10 # AUTHOR
11 # Andy Wardley <abw@kfs.org>
12 #
13 # COPYRIGHT
14 # Copyright (C) 2001 Canon Research Centre Europe Ltd.
15 # All Rights Reserved.
16 #
17 # This module is free software; you can redistribute it and/or
18 # modify it under the same terms as Perl itself.
19 #
20 # REVISION
21 # $Id: Type.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $
22 #
23 #========================================================================
24  
25 package XML::Schema::Type;
26  
27 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 28 ▶use XML::Schema::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 28 ▶use XML::Schema::Type::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 28 ▶use XML::Schema::Type::Complex;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 28 ▶use base qw( XML::Schema::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
33 28 ▶use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL );
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 28 $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
36 28 ▶$DEBUG = 0 unless defined $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $XML::Schema::Type::DEBUG 28 0 28
37 28 $ERROR = '';
38  
39 28 @MANDATORY = qw( );
40 28 @OPTIONAL = qw( name namespace base );
41  
42  
43 #------------------------------------------------------------------------
44 # init()
45 #------------------------------------------------------------------------
46  
47 3 ▶sub init {
Subroutine init: called CC=4 SCAR=15.8
Pod documented
48 3 my ($self, $config) = @_;
49 3 my ($name, $value);
50  
51 my ($mand, $option)
52 3 = @{ $self->_baseargs( qw( @MANDATORY %OPTIONAL ) ) };
53  
54 3 ▶ $self->_mandatory($mand, $config)
Branch: 1 branch
BranchTrueFalseTotal
if @$mand 0 3 3
Condition20%1/5
@$mand && ($self->_mandatory($mand, $config) || (return))
!ll&&!rl&&r
300
$self->_mandatory($mand, $config) or return
l!l
00
MC/DC0%0/2
@$mand && ($self->_mandatory($mand, $config) || (return))
@$mand $self->_mandatory($mand, $config)
Truth table33%1/3
A && B
A= @$mandB= $self->_mandatory($mand, $config)
ABresult
0X0
100
111
55 || return if @$mand;
56  
57 3 ▶ $self->_optional($option, $config)
Branch: 1 branch
BranchTrueFalseTotal
$self->_optional($option, $config) or return 3 0 3
58 || return;
59  
60 3 return $self;
61 }
62  
63  
64 #------------------------------------------------------------------------
65 # base()
66 #
67 # Returns the value of the 'base' item, denoting a base class type.
68 #------------------------------------------------------------------------
69  
70 1 ▶sub base {
Subroutine base: called CC=1 SCAR=0.0
Pod undocumented
71 1 my $self = shift;
72 1 return $self->{ base };
73 }
74  
75  
76 #------------------------------------------------------------------------
77 # name()
78 #
79 # Returns the type name.
80 #------------------------------------------------------------------------
81  
82 46 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
83 46 my $self = shift;
84 46 return $self->{ name };
85 }
86  
87  
88 #------------------------------------------------------------------------
89 # namespace()
90 #
91 # Returns the type namespace.
92 #------------------------------------------------------------------------
93  
94 1 ▶sub namespace {
Subroutine namespace: called CC=1 SCAR=0.0
Pod undocumented
95 1 my $self = shift;
96 1 return $self->{ namespace };
97 }
98  
99 28 1;
100  
101 __END__
« lib/XML/Schema/Facet/Builtin.pm ↑ Summary lib/XML/Schema/Facet.pm »