diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-10-13 11:25:00 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-10-13 11:25:00 +0200 |
commit | 706aedbac8bf454fb1eb3dc03ace1ed09a50e9fc (patch) | |
tree | dcfc859d90ffff1ce141092ba45ac3226912d39f /lib | |
parent | e5f4d91308e769338fe2ddc0f68c6b5dd99033ee (diff) |
do not store unused data in $self
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/URA.pm | 14 |
1 files 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; } |