Essex/NamespaceMap.pm

filter: Statementstmt 29.4% 5 / 17 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 33.3% 1 / 3 Podpod 100% 1 / 1 totaltotal 18.9% 7 / 37 CC 6 SCAR 30.1
CC
6
Cov
17%
new
30.0
DESTROY
6.0
BEGIN
1.0
CRAP 20.4
« Filter/Essex/Foo.pm ↑ Summary Essex/Filter/OutputMonitor.pm »
1 package XML::Essex::NamespaceMap;
2  
3 1 $VERSION = 0.000_1;
4  
5 =head1 NAME
6  
7 XML::Essex::NamespaceMap - ...
8  
9 =head1 SYNOPSIS
10  
11 =head1 DESCRIPTION
12  
13 Contains a mapping of namespaces to prefixes.
14  
15 =head1 METHODS
16  
17 =over
18  
19 =cut
20  
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =item new
24  
25 my $map = ns_map $ns1 => $prefix1, ...; ## In Essex scripts.
26 my $map = XML::Essex::NamespaceMap->new(
27 $essex,
28 $ns1 => $prefix1,
29 ...
30 );
31 my $unregistered_map = XML::Essex::NamespaceMap->new(
32 $ns1 => $prefix1,
33 ...
34 );
35  
36 =cut
37  
38 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
39 0 my $proto = shift;
40 0 my $essex;
41 0 ▶ $essex = shift if @_ && UNIVERSAL::isa( $_[0], "XML::Essex" );
Branch: 1 branch
BranchTrueFalseTotal
if @_ and UNIVERSAL::isa($_[0], "XML::Essex") 0 0 0
Condition0%0/3
@_ and UNIVERSAL::isa($_[0], "XML::Essex")
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and UNIVERSAL::isa($_[0], "XML::Essex")
@_ UNIVERSAL::isa($_[0], "XML::Essex")
Truth table0%0/3
A and B
A= @_B= UNIVERSAL::isa($_[0], "XML::Essex")
ABresult
0X0
100
111
42 0 my %map = @_;
43  
44 0 ▶ my $self = bless {
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
45 Essex => $essex,
46 Map => \%map,
47 }, ref $proto || $proto;
48  
49 0 ▶ $self->{Essex}->add_namespace_map( $self->{Map} ) if $self->{Essex};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"Essex"} 0 0 0
50  
51 0 return $self;
52 }
53  
54 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=2 SCAR=17.9
55 0 my $self = shift;
56  
57 0 ▶ if ( $self->{Essex} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'Essex'}) { } 0 0 0
58 0 $self->{Essex}->remove_namespace_map( $self->{Map} );
59 }
60 else {
61 ## Clear out the map in case it was added to an Essex
62 ## we don't happen to refer to.
63 0 %{$self->{Map}} = ();
64 }
65 }
66  
67 =back
68  
69 =head1 LIMITATIONS
70  
71 No way to get at the namespaces and prefixes. Can add one when one
72 is needed, most uses should go through the essex object to fall back
73 to earlier mappings if a mapping doesn't happen to have a particular
74 namespace or prefix.
75  
76 =head1 COPYRIGHT
77  
78 Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved
79  
80 =head1 LICENSE
81  
82 You may use this module under the terms of the BSD, Artistic, oir GPL licenses,
83 any version.
84  
85 =head1 AUTHOR
86  
87 Barrie Slaymaker <barries@slaysys.com>
88  
89 =cut
90  
91 1 1;
« Filter/Essex/Foo.pm ↑ Summary Essex/Filter/OutputMonitor.pm »