From 25ac11cf7e697f66637c3c7c304698d8bbcc642a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 29 Oct 2022 10:45:14 +0200 Subject: Message: add is_him accessor; fix documentation --- lib/Travel/Status/DE/HAFAS.pm | 1 + lib/Travel/Status/DE/HAFAS/Message.pm | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index e1876d8..dc26842 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -558,6 +558,7 @@ sub add_message { text => $text, code => $code, prio => $prio, + is_him => $is_him, ref_count => 1, ); push( @{ $self->{messages} }, $message ); diff --git a/lib/Travel/Status/DE/HAFAS/Message.pm b/lib/Travel/Status/DE/HAFAS/Message.pm index e70e30e..bce2496 100644 --- a/lib/Travel/Status/DE/HAFAS/Message.pm +++ b/lib/Travel/Status/DE/HAFAS/Message.pm @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '4.00'; Travel::Status::DE::HAFAS::Message->mk_ro_accessors( - qw(short text code prio ref_count)); + qw(short text code prio is_him ref_count)); sub new { my ( $obj, %conf ) = @_; @@ -36,11 +36,11 @@ Travel::Status::DE::HAFAS::Message - An arrival/departure-related message. =head1 SYNOPSIS - if ($message->lead) { - printf("%s: %s\n", $message->header, $message->lead); + if ($message->text) { + printf("%s: %s\n", $message->short, $message->text); } else { - say $message->header; + say $message->short; } =head1 VERSION @@ -59,12 +59,12 @@ construction work, the expected passenger volume, or similar. =over -=item $message->header +=item $message->short Message header. May be a concise single-sentence summary or a mostly useless string such as "Information". Does not contain newlines. -=item $message->lead +=item $message->text Detailed message content. Does not contain newlines. @@ -74,6 +74,12 @@ Counter indicating how often this message is used by the requested arrivals/departures. ref_count is an integer between 1 and the number of results. If ref_count is 1, it is referenced by a single result only. +=item $message->is_him + +True if it is a HIM message (typically used for service information), false +if not (message may be a REM instead, indicating e.g. presence of a bicycle +carriage or WiFi). + =back =head1 DIAGNOSTICS -- cgit v1.2.3