EFA/PlaceFactory.pm

filter: Statementstmt 50.0% 8 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 50.0% 11 / 22 CC 2 SCAR 12.5
CC
2
Cov
44%
place_from_itdOdvPlace
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« EFA/DateFactory.pm ↑ Summary EFA/HeaderFactory.pm »
1 package WWW::EFA::PlaceFactory;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use WWW::EFA::Place;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 =head1 NAME
5  
6 WWW::EFA::PlaceFactory - A Factory for creating L<WWW::EFA::Place> objects.
7  
8 =head1 VERSION
9  
10 Version 0.01
11  
12 =cut
13  
14 2 our $VERSION = '0.01';
15  
16 =head1 SYNOPSIS
17  
18 my $factory = WWW::EFA::PlaceFactory->new();
19  
20 =head1 METHODS
21  
22 =head2 place_from_itdOdvPlace
23  
24 Returns a L<WWW::EFA::Place> object
25  
26 my $place = $factory->place_from_itdOdvPlace( $itd_odv->findnodes( '/itdOdvPlace' ) );
27  
28 Expects an XML::LibXML::Element of XML like this:
29  
30
31 <itdOdvPlace state="identified" method="itp">
32 <odvPlaceElem omc="9162000" placeID="1" value="9162000:1" span="0" type="remote" mainPlace="1">München</odvPlaceElem>
33 <odvPlaceInput/>
34 </itdOdvPlace>
35  
36 =cut
37 0 ▶sub place_from_itdOdvPlace {
Subroutine place_from_itdOdvPlace: not called CC=2 SCAR=17.9
Pod documented
38 0 my $self = shift;
39 0 my $element = shift;
40  
41 0 printf "Element is a %s\n", ref( $element );
42 0 my $state = $element->getAttribute( 'state' );
43 0 my( $place_elem ) = $element->findnodes( 'odvPlaceElem' );
44
45 0 ▶ croak( "No odvPlaceElem found" ) if not $place_elem;
Branch: 1 branch
BranchTrueFalseTotal
unless $place_elem 0 0 0
46  
47 0 my $place = WWW::EFA::Place->new(
48 id => $place_elem->getAttribute( 'placeID' ),
49 type => $place_elem->getAttribute( 'type' ),
50 name => $place_elem->textContent,
51 state => $state,
52 );
53 0 return $place;
54 }
55  
56 2 1;
57  
58 =head1 COPYRIGHT
59  
60 Copyright 2011, Robin Clarke, Munich, Germany
61  
62 =head1 AUTHOR
63  
64 Robin Clarke <perl@robinclarke.net>
65  
« EFA/DateFactory.pm ↑ Summary EFA/HeaderFactory.pm »