From b71529f3b7fed44b337027a623252db346acd1a0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 5 Jun 2010 17:56:21 +0200 Subject: Use HTML::TreeBuilder::XPath for parsing. Todo: Lots of code cleanup. --- bin/efa | 264 +++++++++++++++++++--------------------------------------------- 1 file changed, 76 insertions(+), 188 deletions(-) (limited to 'bin/efa') diff --git a/bin/efa b/bin/efa index 92893a5..c9cdb36 100755 --- a/bin/efa +++ b/bin/efa @@ -6,8 +6,10 @@ use strict; use warnings; use encoding 'utf8'; use 5.010; + use Encode; use Getopt::Long qw/:config no_ignore_case/; +use HTML::TreeBuilder::XPath; use WWW::Mechanize; my $firsturl = 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2?language=de&itdLPxx_transpCompany=vrr'; @@ -19,7 +21,6 @@ my %post; my $www = WWW::Mechanize->new( autocheck => 1, ); -my $raw; my (@from, @to, @via); my ($from_type, $to_type, $via_type) = ('stop') x 3; my ($time, $time_depart, $time_arrive); @@ -31,183 +32,16 @@ my $prefer; my $proximity; my $walk_speed; my $with_bike; -my $debug = 0; my $timeout = 60; my $ignore_info = 'Fahrradmitnahme'; my ($test_dump, $test_parse); -sub check_ambiguous { - my $html = shift; - my $choose_re = qr{ - - Bitte \s auswählen - - }x; - my $select_re = qr{ -