File Coverage

blib/lib/XML/Validator/Schema/Node.pm
Criterion Covered Total %
statement 6 10 60.0
branch 1 4 25.0
condition n/a
subroutine 2 4 50.0
pod 2 3 66.6
total 11 21 52.3


line stmt bran cond sub pod time code
1             package XML::Validator::Schema::Node;
2 5     5   28 use base qw(Tree::DAG_Node);
  5         8  
  5         6598  
3              
4             =head1 NAME
5              
6             XML::Validator::Schema::Node
7              
8             =head1 DESCRIPTION
9              
10             Base class for nodes in the schema tree. Used by both temporary nodes
11             resolved during compilation (ex. ::ModelNode) and permanent nodes
12             (ex. ::ElementNode).
13              
14             This is an abstract base class and may not be directly instantiated.
15              
16             =cut
17              
18             sub new {
19 10     10 1 21 my $pkg = shift;
20 10 50       27 croak("Illegal attempt to instantiate a Node directly!")
21             if $pkg eq __PACKAGE__;
22 10         53 return $pkg->SUPER::new(@_);
23             }
24              
25             sub parse {
26 0     0 0   my $pkg = shift;
27 0           croak("$pkg neglected to supply a parse() implementation!");
28             }
29              
30             # override to declare root-ness
31             sub is_root {
32 0 0   0 1   return 0 if shift->{mother};
33 0           return 1;
34             }
35              
36             1;
37