lib/XML/Schema/Element.pm

filter: Statementstmt 81.5% 31 / 38 Branchbran 62.5% 5 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 72.7% 8 / 11 Podpod 20.0% 1 / 5 totaltotal 67.1% 45 / 67 CC 5 SCAR 8.6
CC
5
Cov
73%
handler
6.0
init
3.1
name
2.0
CRAP 2.4
« lib/XML/Schema/Type/Union.pm ↑ Summary lib/XML/Schema/Facet/Builtin.pm »
1 #============================================================= -*-perl-*-
2 #
3 # XML::Schema::Element.pm
4 #
5 # DESCRIPTION
6 # Module implementing an object class for XML Schema elements.
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: Element.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $
20 #
21 #========================================================================
22  
23 package XML::Schema::Element;
24  
25 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 28 ▶use XML::Schema;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 28 ▶use XML::Schema::Scoped;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 28 ▶use XML::Schema::Scheduler;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 28 ▶use base qw( XML::Schema::Scoped XML::Schema::Scheduler );
Subroutine BEGIN: called CC=1 SCAR=0.0
30 28 ▶use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL @SCHEDULES );
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 28 $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
33 28 ▶$DEBUG = 0 unless defined $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $XML::Schema::Element::DEBUG 28 0 28
34 28 $ERROR = '';
35  
36 # mandatory 'type' implied by XML::Schema::Scoped base class
37 28 @MANDATORY = qw( name );
38 # optional 'scope' implied by XML::Schema::Scoped base class
39 28 @OPTIONAL = qw( namespace annotation );
40 28 @SCHEDULES = qw( start_element start_child end_child end_element text );
41  
42  
43 #------------------------------------------------------------------------
44 # init()
45 #------------------------------------------------------------------------
46  
47 11 ▶sub init {
Subroutine init: called CC=3 SCAR=11.4
Pod documented
48 11 my ($self, $config) = @_;
49  
50 # call base class (XML::Schema::Scoped) initialiser
51 11 ▶ $self->SUPER::init($config)
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($config) or return 11 0 11
52 || return;
53  
54 # call XML::Schema::Scheduler initialiser
55 11 ▶ $self->init_scheduler($config)
Branch: 1 branch
BranchTrueFalseTotal
$self->init_scheduler($config) or return 11 0 11
56 || return;
57  
58 11 return $self;
59 }
60  
61  
62 #------------------------------------------------------------------------
63 # name($newname)
64 #
65 # Accesor method to fetch (no arguments) or update (first argument)
66 # element name.
67 #------------------------------------------------------------------------
68  
69 30 ▶sub name {
Subroutine name: called CC=2 SCAR=6.9
Pod undocumented
70 30 my $self = shift;
71 30 ▶ return @_ ? ($self->{ name } = shift) : $self->{ name };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 29 30
72 }
73  
74  
75 #------------------------------------------------------------------------
76 # handler($instance)
77 #
78 # Called
79 #------------------------------------------------------------------------
80  
81 0 ▶sub handler {
Subroutine handler: not called CC=2 SCAR=17.9
Pod undocumented
82 0 my ($self, $instance) = @_;
83 0 my $type = $self->type();
84 0 ▶ return $type->handler($instance, $self)
Condition0%0/3
$type->handler($instance, $self) || $self->error($type->error)
l!l&&r!l&&!r
000
MC/DC0%0/2
$type->handler($instance, $self) || $self->error($type->error)
$type->handler($instance, $self) $self->error($type->error)
Truth table0%0/3
A || B
A= $type->handler($instance, $self)B= $self->error($type->error)
ABresult
1X1
011
000
85 || $self->error($type->error());
86 }
87  
88 0 ▶sub present {
Subroutine present: not called CC=1 SCAR=6.9
Pod undocumented
89 0 my ($self, $view) = @_;
90 0 $view->view( element => $self );
91 }
92  
93 0 ▶sub ID {
Subroutine ID: not called CC=1 SCAR=6.9
Pod undocumented
94 0 my $self = shift;
95 0 return "Element[$self->{ name }]";
96 }
97  
98  
99 28 1;
100  
101 __END__
« lib/XML/Schema/Type/Union.pm ↑ Summary lib/XML/Schema/Facet/Builtin.pm »