| 1 | package HTTP::OAI::Metadata; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | @ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); | |||||||||
| 4 | |||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 11 | our $VERSION = '4.11'; | |||||||||
| 8 | |||||||||||
| 9 | sub new | ||||||||||
| 10 | { | ||||||||||
| 11 | 15 | ▶ | my( $class, %self ) = @_; | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 15 | my $inst = bless \%self, $class; | |||||||||
| 14 | |||||||||||
| 15 | 15 | ▶ | if ($self{dom}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | $inst->_elem("dom", $self{dom}); | |||||||||
| 17 | } | ||||||||||
| 18 | else { | ||||||||||
| 19 | 15 | $inst->{doc} = XML::LibXML::Document->new( '1.0', 'UTF-8' ); | |||||||||
| 20 | 15 | $inst->{dom} = $inst->{current} = $inst->{doc}->createDocumentFragment; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 15 | return $inst; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub metadata { shift->dom( @_ ) } | ||||||||
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 4 | ▶ | sub dom { shift->_elem( "dom", @_ ) } | ||||||||
|
Subroutine
dom: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | |||||||||||
| 29 | sub generate | ||||||||||
| 30 | { | ||||||||||
| 31 | 3 | ▶ | my( $self, $driver ) = @_; | ||||||||
|
Subroutine
generate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 32 | |||||||||||
| 33 | 3 | $driver->generate( $self->dom ); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub start_element | ||||||||||
| 37 | { | ||||||||||
| 38 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
start_element: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 39 | |||||||||||
| 40 | my $node = $self->{doc}->createElementNS( | ||||||||||
| 41 | $hash->{NamespaceURI}, | ||||||||||
| 42 | $hash->{Name}, | ||||||||||
| 43 | 175 | ); | |||||||||
| 44 | 175 | foreach my $attr (values %{$hash->{Attributes}}) | |||||||||
| 45 | { | ||||||||||
| 46 | 119 | ▶ | Carp::confess "Can't setAttribute without attribute name" if !defined $attr->{Name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 119 | $node->setAttribute( $attr->{Name}, $attr->{Value} ); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 175 | $self->{current} = $self->{current}->appendChild( $node ); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | sub end_element | ||||||||||
| 54 | { | ||||||||||
| 55 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
end_element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | |||||||||||
| 57 | 175 | $self->{current} = $self->{current}->parentNode; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | sub characters | ||||||||||
| 61 | { | ||||||||||
| 62 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
characters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 63 | |||||||||||
| 64 | 175 | $self->{current}->appendText( $hash->{Data} ); | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 11 | 1; | |||||||||
| 68 | |||||||||||
| 69 | __END__ | ||||||||||