Loading Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Detect ambiguous input errors (available via errstr) Travel::Status::DE::DeutscheBahn 1.00 - Sun Sep 04 2011 [db-ris] Loading lib/Travel/Status/DE/DeutscheBahn.pm +27 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ sub new { suppress_warnings => 1, ); $ref->check_input_error(); return $ref; } Loading @@ -96,6 +98,31 @@ sub new_from_html { return bless( $ref, $obj ); } sub check_input_error { my ($self) = @_; my $xp_errdiv = XML::LibXML::XPathExpression->new( '//div[@class = "errormsg leftMargin"]'); my $xp_opts = XML::LibXML::XPathExpression->new('//select[@class = "error"]'); my $xp_values = XML::LibXML::XPathExpression->new('./option'); my $e_errdiv = ( $self->{tree}->findnodes($xp_errdiv) )[0]; my $e_opts = ( $self->{tree}->findnodes($xp_opts) )[0]; if ($e_errdiv) { $self->{errstr} = $e_errdiv->textContent; if ($e_opts) { my @nodes = ( $e_opts->findnodes($xp_values) ); $self->{errstr} .= join( q{}, map { "\n" . $_->textContent } @nodes ); } } return; } sub errstr { my ($self) = @_; Loading Loading
Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Detect ambiguous input errors (available via errstr) Travel::Status::DE::DeutscheBahn 1.00 - Sun Sep 04 2011 [db-ris] Loading
lib/Travel/Status/DE/DeutscheBahn.pm +27 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ sub new { suppress_warnings => 1, ); $ref->check_input_error(); return $ref; } Loading @@ -96,6 +98,31 @@ sub new_from_html { return bless( $ref, $obj ); } sub check_input_error { my ($self) = @_; my $xp_errdiv = XML::LibXML::XPathExpression->new( '//div[@class = "errormsg leftMargin"]'); my $xp_opts = XML::LibXML::XPathExpression->new('//select[@class = "error"]'); my $xp_values = XML::LibXML::XPathExpression->new('./option'); my $e_errdiv = ( $self->{tree}->findnodes($xp_errdiv) )[0]; my $e_opts = ( $self->{tree}->findnodes($xp_opts) )[0]; if ($e_errdiv) { $self->{errstr} = $e_errdiv->textContent; if ($e_opts) { my @nodes = ( $e_opts->findnodes($xp_values) ); $self->{errstr} .= join( q{}, map { "\n" . $_->textContent } @nodes ); } } return; } sub errstr { my ($self) = @_; Loading