| 1 | package WWW::EFA::HeaderFactory; | ||||||||||
| 2 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use WWW::EFA::ResultHeader; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | WWW::EFA::HeaderFactory - A (very small) Factory for creating L<WWW::EFA::ResultHeader> objects. | ||||||||||
| 9 | |||||||||||
| 10 | =head1 VERSION | ||||||||||
| 11 | |||||||||||
| 12 | Version 0.01 | ||||||||||
| 13 | |||||||||||
| 14 | =cut | ||||||||||
| 15 | |||||||||||
| 16 | 2 | our $VERSION = '0.01'; | |||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | my $factory = WWW::EFA::HeaderFactory->new(); | ||||||||||
| 21 | |||||||||||
| 22 | =head1 METHODS | ||||||||||
| 23 | |||||||||||
| 24 | =head2 header_from_result | ||||||||||
| 25 | |||||||||||
| 26 | Returns a L<WWW::EFA::ResultHeader> object | ||||||||||
| 27 | |||||||||||
| 28 | my $location = $factory->header_from_result( $doc ); | ||||||||||
| 29 | |||||||||||
| 30 | Expects an XML::LibXML::Element of XML with this as its root element: | ||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | <itdRequest version="9.16.27.42" language="de" lengthUnit="METER" | ||||||||||
| 34 | sessionID="MVV1_4147296033" client="libwww-perl/6.03" | ||||||||||
| 35 | clientIP="192.168.0.190" serverID="MVV1_" virtDir="mobile" | ||||||||||
| 36 | now="2011-11-10T15:16:22" nowWD="5"> | ||||||||||
| 37 | ... | ||||||||||
| 38 | </itdRequest> | ||||||||||
| 39 | |||||||||||
| 40 | =cut | ||||||||||
| 41 | 0 | ▶ | sub header_from_result { | ||||||||
|
Subroutine
header_from_result: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 42 | 0 | my $self = shift; | |||||||||
| 43 | 0 | my $elem = shift; | |||||||||
| 44 | |||||||||||
| 45 | 0 | my( $req_elem ) = $elem->findnodes( '/itdRequest' ); | |||||||||
| 46 | 0 | ▶ | if( not $req_elem ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | croak( "Could not find itdRequest element" ); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | my $header = WWW::EFA::ResultHeader->new( | |||||||||
| 51 | version => $req_elem->getAttribute( 'version' ), | ||||||||||
| 52 | language => $req_elem->getAttribute( 'language' ), | ||||||||||
| 53 | server_time => Class::Date->new( $req_elem->getAttribute( 'now' ) ), | ||||||||||
| 54 | server_id => $req_elem->getAttribute( 'serverID' ), | ||||||||||
| 55 | length_unit => $req_elem->getAttribute( 'lengthUnit' ), | ||||||||||
| 56 | session_id => $req_elem->getAttribute( 'sessionID' ), | ||||||||||
| 57 | ); | ||||||||||
| 58 | 0 | return $header; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 2 | 1; | |||||||||
| 62 | |||||||||||
| 63 | =head1 COPYRIGHT | ||||||||||
| 64 | |||||||||||
| 65 | Copyright 2011, Robin Clarke, Munich, Germany | ||||||||||
| 66 | |||||||||||
| 67 | =head1 AUTHOR | ||||||||||
| 68 | |||||||||||
| 69 | Robin Clarke <perl@robinclarke.net> | ||||||||||
| 70 | |||||||||||