Commit c2190255 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Code cleanup, remove WWW::Efa::Error stuff for now (to be reimplemented)

parent b09b7e7c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
/blib
/cover_db
/MANIFEST
/MANIFEST.bak
/MANIFEST.SKIP
/MANIFEST.SKIP.bak
/MYMETA.yml
+44 −57
Original line number Diff line number Diff line
@@ -9,10 +9,8 @@ use 5.010;
use Getopt::Long qw/:config no_ignore_case/;
use WWW::Efa;

my $VERSION = '1.3+git';
my %post;
our $VERSION = '1.3';
my $ignore_info = 'Fahrradmitnahme';
my ($test_dump, $test_parse);
my $efa;
my ( @from, @to, @via, $from_type, $to_type, $via_type );
my $opt = {
@@ -24,9 +22,10 @@ my $opt = {
	'via' => \@via,
};

binmode(STDOUT, ':utf8');
binmode(STDERR, ':utf8');
binmode( STDOUT, ':encoding(utf-8)' );
binmode( STDERR, ':encoding(utf-8)' );

#<<<
GetOptions(
	$opt,
	qw{
@@ -52,7 +51,7 @@ GetOptions(
		walk-speed|w=s
	},
) or die("Please see perldoc -F $0\n");

#>>>
if ( not( @from and @to ) ) {
	if ( @ARGV == 4 ) {
		( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
@@ -62,15 +61,15 @@ if (not (@from and @to)) {
	}
}

for my $pair (
	[\@from, \$from_type],
	[\@via , \$via_type ],
	[\@to  , \$to_type  ],
) {
for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ],
	[ \@to, \$to_type ], )
{
	next if ( not defined $pair->[0]->[1] );

	if ($pair->[0]->[1] =~ s{ ^ (?<type> [^:]+ ) : \s* (?<target> .+ ) $ }
		{$+{target}}x)
	if (
		$pair->[0]->[1] =~ s{ ^ (?<type> [^:]+ ) : \s* (?<target> .+ ) $ }
		{$+{target}}x
	  )
	{
		given ( $+{type} ) {
			when ('addr') { ${ $pair->[1] } = 'address' }
@@ -97,21 +96,9 @@ $efa = WWW::Efa->new(
	max_interchanges => $opt->{'max-change'},
);

if ($efa->error()) {
	die $efa->error()->as_string();
}
$efa->submit( timeout => $opt->{'timeout'} );

if ($opt->{'test-parse'}) {
	local $/ = undef;
	$efa->{'html_reply'} = <STDIN>;
}
else {
	$efa->submit(
		timeout => $opt->{'timeout'}
	);
}

$efa->parse or die $efa->error()->as_string();
$efa->parse();

my @connections = $efa->connections();

@@ -127,12 +114,8 @@ for my $i (0 .. $#connections) {

		printf(
			"%-5s ab  %-30s %-20s %s\n%-5s an  %-30s\n\n",
			$c->{'dep_time'},
			$c->{'dep_stop'},
			$c->{'train_line'},
			$c->{'train_dest'},
			$c->{'arr_time'},
			$c->{'arr_stop'},
			$c->{'dep_time'},   $c->{'dep_stop'}, $c->{'train_line'},
			$c->{'train_dest'}, $c->{'arr_time'}, $c->{'arr_stop'},
		);
	}
	if ( $i != $#connections ) {
@@ -156,6 +139,10 @@ efa - unofficial efa.vrr.de command line client

=back

=head1 VERSION

version 1.3

=head1 DESCRIPTION

B<efa> is a command line client for the L<http://efa.vrr.de> web interface.
+388 −399

File changed.

Preview size limit exceeded, changes collapsed.

lib/WWW/Efa/Error/Ambiguous.pm

deleted100644 → 0
+0 −69

File deleted.

Preview size limit exceeded, changes collapsed.

lib/WWW/Efa/Error/Backend.pm

deleted100644 → 0
+0 −60

File deleted.

Preview size limit exceeded, changes collapsed.

Loading