File Coverage

lib/XML/Schema/Handler.pm
Criterion Covered Total %
statement 23 27 85.1
branch 4 6 66.6
condition 4 6 66.6
subroutine 6 8 75.0
pod 1 4 25.0
total 38 51 74.5


line stmt bran cond sub pod time code
1             #============================================================= -*-perl-*-
2             #
3             # XML::Schema::Handler
4             #
5             # DESCRIPTION
6             # Module implementing a base class parser handler.
7             #
8             # AUTHOR
9             # Andy Wardley
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     2   12 use strict;
  2         4  
  2         69  
26 2     2   14 use XML::Schema::Scheduler;
  2         3  
  2         53  
27 2     2   10 use base qw( XML::Schema::Scheduler );
  2         5  
  2         195  
28 2     2   12 use vars qw( $VERSION $DEBUG $ERROR @MANDATORY @OPTIONAL );
  2         6  
  2         830  
29              
30             $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
31             $DEBUG = 0 unless defined $DEBUG;
32             $ERROR = '';
33              
34             #@MANDATORY = qw( type );
35             @OPTIONAL = qw( name type );
36              
37              
38             #------------------------------------------------------------------------
39             # init()
40             #------------------------------------------------------------------------
41              
42             sub init {
43 5     5 1 7 my ($self, $config) = @_;
44 5         7 my ($name, $value);
45              
46 5 50       26 $self->init_scheduler($config)
47             || return;
48              
49 5         14 my ($mand, $option)
50 5         9 = @{ $self->_baseargs( qw( @MANDATORY @OPTIONAL ) ) };
51              
52 5 100 100     36 $self->_mandatory($mand, $config)
53             || return if @$mand;
54              
55 4 50 50     30 $self->_optional($option, $config)
56             || return if @$option;
57              
58 4   50     25 $self->{ name } ||= '';
59              
60 4         32 return $self;
61             }
62              
63              
64             #------------------------------------------------------------------------
65             # accessor methods
66             #------------------------------------------------------------------------
67              
68             sub type {
69 2     2 0 3 my $self = shift;
70 2         10 return $self->{ type };
71             }
72              
73             sub name {
74 0     0 0   my $self = shift;
75 0           return $self->{ name };
76             }
77              
78              
79             sub ID {
80 0     0 0   my $self = shift;
81 0           return "Handler[$self->{ name }]";
82             }
83              
84             1;
85              
86             __END__