From 706aedbac8bf454fb1eb3dc03ace1ed09a50e9fc Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 13 Oct 2015 11:25:00 +0200 Subject: do not store unused data in $self --- lib/Travel/Status/DE/URA.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index b9ef6bb..c76843e 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -65,26 +65,26 @@ sub new { return $self; } - $self->{raw_str} = $response->decoded_content; + my $raw_str = $response->decoded_content; if ( $self->{developer_mode} ) { - say $self->{raw_str}; + say $raw_str; } # Fix encoding in case we're running through test files if ( substr( $self->{ura_instant_url}, 0, 5 ) eq 'file:' ) { - $self->{raw_str} = encode( 'UTF-8', $self->{raw_str} ); + $raw_str = encode( 'UTF-8', $raw_str ); } - $self->parse_raw_data; + $self->parse_raw_data($raw_str); return $self; } sub parse_raw_data { - my ($self) = @_; + my ($self, $raw_str) = @_; my $csv = Text::CSV->new( { binary => 1 } ); - for my $dep ( split( /\r\n/, $self->{raw_str} ) ) { + for my $dep ( split( /\r\n/, $raw_str ) ) { $dep =~ s{^\[}{}; $dep =~ s{\]$}{}; @@ -233,8 +233,6 @@ sub results { sort { $a->[1] <=> $b->[1] } map { [ $_, $_->datetime->epoch ] } @results; - $self->{results} = \@results; - return @results; } -- cgit v1.2.3