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. --- Changelog | 4 + bin/efa | 264 ++++++++++++++++++-------------------------------------------- 2 files changed, 80 insertions(+), 188 deletions(-) diff --git a/Changelog b/Changelog index c6f6de0..8ea6c13 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +git HEAD + + * Rewrite efa parser using HTML::TreeBuilder::XPath + efa 1.1.2 - Wed May 12 2010 * Fix -v 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{ -