| 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
| |||||||||||
| 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 | |||||||||||