Romani/Query/XML/Where.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 56 CC 6 SCAR 30.2
CC
6
Cov
0%
create_where_from_node
42.0
BEGIN
2.0
BEGIN
2.0
CRAP 20.5
1  
2 package DBIx::Romani::Query::XML::Where;
3  
4 use DBIx::Romani::Query::XML::Util;
5 use DBIx::Romani::Query::XML::SQL;
6 use DBIx::Romani::Query::Comparison;
7 use DBIx::Romani::Query::Where;
8 use XML::DOM;
9 use strict;
10  
11 use Data::Dumper;
12  
13 sub create_where_from_node
14 {
15 my $op_node = shift;
16  
17 my $name = $op_node->getLocalName();
18 my $ns_uri = $op_node->getNamespaceURI();
19  
20 my $op;
21  
22 # create the actual object
23 if ( $ns_uri eq $DBIx::Romani::Query::XML::Util::NS_QUERY_OPERATOR )
24 {
25 if ( $name eq 'and' )
26 {
27 $op = DBIx::Romani::Query::Where->new( $DBIx::Romani::Query::Where::AND );
28 }
29 elsif ( $name eq 'equal' )
30 {
31 $op = DBIx::Romani::Query::Comparison->new( $DBIx::Romani::Query::Comparison::EQUAL );
32 }
33 }
34  
35 if ( not defined $op )
36 {
37 die "Unknown operator \"$ns_uri\" \"$name\"";
38 }
39  
40 # go through the children
41 my $node = $op_node->getFirstChild();
42 while ( defined $node )
43 {
44 if ( $node->getNodeType() == XML::DOM::ELEMENT_NODE )
45 {
46 # operators can hold other things regarded as where
47 $op->add( DBIx::Romani::Query::XML::SQL::create_where_from_node($node) );
48 }
49  
50 $node = $node->getNextSibling();
51 }
52  
53 return $op;
54 }
55  
56 1;
57