lib/XML/Schema/Type/List.pm

filter: Statementstmt 100% 29 / 29 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 91.4% 43 / 47 CC 4 SCAR 5.9
CC
4
Cov
95%
split
3.0
init
2.0
BEGIN
1.0
CRAP 1.8
« blib/lib/XML/Schema/Annotation.pm ↑ Summary lib/XML/Schema/Parser.pm »
1 #============================================================= -*-perl-*-
2 #
3 # XML::Schema::Type::List
4 #
5 # DESCRIPTION
6 # Module implementing the XML Schema list datatype.
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: List.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $
20 #
21 #========================================================================
22  
23 package XML::Schema::Type::List;
24  
25 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 28 ▶use XML::Schema::Type::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 28 ▶use base qw( XML::Schema::Type::Simple );
Subroutine BEGIN: called CC=1 SCAR=0.0
28 28 ▶use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @FACETS );
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 28 $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
31 28 ▶$DEBUG = 0 unless defined $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $XML::Schema::Type::List::DEBUG 28 0 28
32 28 $ERROR = '';
33  
34 28 @MANDATORY = qw( itemType );
35 @FACETS = (
36 whiteSpace => 'collapse',
37 15 ▶ sub { $_[1]->split($_[0]) },
Subroutine __ANON__: called CC=1 SCAR=0.0
38 28 );
39  
40 15 ▶sub split {
Subroutine split: called CC=3 SCAR=11.0
Pod undocumented
41 15 my ($self, $instance) = @_;
42 my $base = $self->{ itemType }
43 15 ▶ || return $self->error('list has no itemType');
Condition50%1/2
$self->{'itemType'} || (return $self->error('list has no itemType'))
l!l
150
MC/DC0%0/1
$self->{'itemType'} || (return $self->error('list has no itemType'))
$self->{'itemType'}
Truth table50%1/2
A
A= $self->{'itemType'}
Aresult
11
00
44 15 my $i = 0;
45  
46 $instance->{ value } = [
47 map {
48 41 ▶ $base->instance($_)
Branch: 1 branch
BranchTrueFalseTotal
$base->instance($_) or return $self->error("list item ${i}: " . $base->error) 37 4 41
49 || return $self->error("list item $i: " . $base->error());
50 37 $i++;
51 } split(/\s+/, $instance->{ value })
52 15 ];
53  
54 11 return 1;
55 }
56  
57 4 ▶sub init {
Subroutine init: called CC=2 SCAR=6.9
Pod documented
58 4 my ($self, $config) = @_;
59 4 ▶ $self->SUPER::init($config)
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($config) or return 3 1 4
60 || return;
61 3 $self->{ _VARIETY } = 'list';
62 3 return $self;
63 }
64  
65  
66 __END__
« blib/lib/XML/Schema/Annotation.pm ↑ Summary lib/XML/Schema/Parser.pm »