File Coverage

blib/lib/XML/EPP/Error.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package XML::EPP::Error;
2              
3             # I've called this class 'error' - extErrValueType is a stupid name.
4              
5 1     1   2556 use Moose;
  0            
  0            
6             use MooseX::Method::Signatures;
7             use Moose::Util::TypeConstraints;
8             use PRANG::Graph;
9              
10             our $SCHEMA_PKG = "XML::EPP";
11              
12             use XML::EPP::Msg;
13             use PRANG::XMLSchema::Whatever;
14              
15             # PRANG::XMLSchema::Whatever means that the object within will
16             # effectively be an unparsed XML fragment
17             subtype "${SCHEMA_PKG}::errValueType"
18             => as "PRANG::XMLSchema::Whatever";
19              
20             with 'XML::EPP::Node';
21              
22             coerce "${SCHEMA_PKG}::errValueType"
23             => from "Str",
24             => via {
25             PRANG::XMLSchema::Whatever->new(
26             contents => [$_],
27             nodenames => [""],
28             );
29             };
30              
31             coerce "${SCHEMA_PKG}::errValueType"
32             => from "XML::LibXML::Element",
33             => via {
34             my $node = $_;
35             my $whatever = PRANG::XMLSchema::Whatever->new(
36             contents => [],
37             nodenames => [$node->localName],
38             nodenames_ns => [$node->namespaceURI],
39             );
40             $whatever->contents->[0] = $node;
41             $whatever;
42             };
43              
44             has_element 'value' =>
45             is => "rw",
46             isa => "${SCHEMA_PKG}::errValueType",
47             coerce => 1,
48             required => 1,
49             xmlns => &xmlns,
50             ;
51              
52             has_element 'reason' =>
53             is => "rw",
54             isa => "${SCHEMA_PKG}::msgType",
55             required => 1,
56             coerce => 1,
57             ;
58              
59             subtype "${SCHEMA_PKG}::extErrValueType"
60             => as __PACKAGE__;
61              
62             1;