Commit 1f28e0d5 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

show wagon model / series

parent 64af46a2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -70,7 +70,8 @@ my $wr = Travel::Status::DE::DBWagenreihung->new(
	train_number   => $train_number,
);

printf("%s %s in %s Gleis %s\n", $wr->train_type, $wr->train_no, $wr->station_name, $wr->platform);
printf( "%s %s in %s Gleis %s\n",
	$wr->train_type, $wr->train_no, $wr->station_name, $wr->platform );

for my $section ( $wr->sections ) {
	my $section_length = $section->length_percent;
@@ -127,7 +128,9 @@ print $wr->direction == 100 ? '>' : '<';
print "\n\n";

for my $wagon ( $wr->wagons ) {
	printf( "%3s: %10s  %s\n",
	printf(
		"%3s: %3s %10s  %s\n",
		$wagon->number || '?',
		$wagon->type, join( q{  }, $wagon->attributes ) );
		$wagon->model, $wagon->type, join( q{  }, $wagon->attributes )
	);
}
+4 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ our $VERSION = '0.00';
Travel::Status::DE::DBWagenreihung::Wagon->mk_ro_accessors(
	qw(attributes class_type has_ac has_accessibility has_bistro has_compartments
	  has_multipurpose is_dosto is_interregio is_locomotive is_powercar number
	  section type)
	  model section type)
);

sub new {
@@ -25,9 +25,12 @@ sub new {
	$ref->{is_locomotive} = 0;
	$ref->{is_powercar}   = 0;
	$ref->{number}        = $opt{wagenordnungsnummer};
	$ref->{model}         = $opt{fahrzeugnummer};
	$ref->{section}       = $opt{fahrzeugsektor};
	$ref->{type}          = $opt{fahrzeugtyp};

	$ref->{model} =~ s{^.....(...)....$}{$1};

	my $self = bless( $ref, $obj );

	$self->parse_type;