summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/URA.pm24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm
index 5280060..610bf10 100644
--- a/lib/Travel/Status/DE/URA.pm
+++ b/lib/Travel/Status/DE/URA.pm
@@ -55,15 +55,7 @@ sub new {
$self->{raw_str} = $response->decoded_content;
- for my $dep ( split( /\r\n/, $self->{raw_str} ) ) {
- $dep =~ s{^\[}{};
- $dep =~ s{\]$}{};
-
- # first field == 4 => version information, no departure
- if ( substr( $dep, 0, 1 ) != 4 ) {
- push( @{ $self->{raw_list} }, [ split( /"?,"?/, $dep ) ] );
- }
- }
+ $self->parse_raw_data;
return $self;
}
@@ -73,7 +65,17 @@ sub new_from_raw {
my $self = { raw_str => $opt{raw_str}, };
- for my $dep ( split( /\r\n/, $self->{raw} ) ) {
+ bless( $self, $class );
+
+ $self->parse_raw_data;
+
+ return $self;
+}
+
+sub parse_raw_data {
+ my ($self) = @_;
+
+ for my $dep ( split( /\r\n/, $self->{raw_str} ) ) {
$dep =~ s{^\[}{};
$dep =~ s{\]$}{};
@@ -83,7 +85,7 @@ sub new_from_raw {
}
}
- return bless( $self, $class );
+ return $self;
}
sub errstr {