summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 010b1f9..4a74692 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -145,14 +145,19 @@ sub new {
my $url = ( $conf{url} // $hafas_instance{$service}{url} ) . "/${lang}n";
- $reply = $ua->post( $url, $ref->{post} );
-
- if ( $reply->is_error ) {
- $ref->{errstr} = $reply->status_line;
- return $ref;
+ if ( $conf{xml} ) {
+ $ref->{raw_xml} = $conf{xml};
}
+ else {
+ $reply = $ua->post( $url, $ref->{post} );
+
+ if ( $reply->is_error ) {
+ $ref->{errstr} = $reply->status_line;
+ return $ref;
+ }
- $ref->{raw_xml} = $reply->content;
+ $ref->{raw_xml} = $reply->content;
+ }
# the interface often does not return valid XML (but it's close!)
if ( substr( $ref->{raw_xml}, 0, 5 ) ne '<?xml' ) {