package WebService::TFL::TubeStatus::Response; use Moo; use WebService::TFL::TubeStatus::Types -all; use WebService::TFL::TubeStatus::Response::Line; use Types::Standard -all; use namespace::autoclean; has lines => ( is => 'ro', isa => ArrayRef[LineT], required => 1, ); sub new_from_xml { my ($class,$doc,$xpath) = @_; my @lines; for my $ls ($xpath->findnodes(q{/ws:ArrayOfLineStatus/ws:LineStatus},$doc)) { my ($line)=$xpath->findnodes(q{ws:Line},$ls); my $line_object = WebService::TFL::TubeStatus::Response::Line->new_from_xml($line,$ls,$xpath); push @lines,$line_object; } return $class->new({lines=>\@lines}); } 1;