NAME

DAIA::Message - An optional information or error message

VERSION

version 0.43

DESCRIPTION

Messages can occurr as property of DAIA::Response, DAIA::Document, DAIA::Item, and DAIA::Availability objects.

PROPERTIES

content

The message as plain Unicode string. The default value is the empty string.

lang

A mandatory RFC 3066 language code. The default value is defined in $DAIA::Message::DEFAULT_LANG and set to 'en'.

errno

By default this property is set to undef. You can set it to any integer for error messages.

The message function is a shortcut for the DAIA::Message constructor:

$msg = DAIA::Message->new( ... );
$msg = message( ... );

The constructor understands several abbreviated ways to define a message:

$msg = message( $content [, lang => $lang ] )
$msg = message( $lang => $content )
$msg = message( $lang => $content )

To set or get all messages of an object, you use the messages accessor. You can pass an array reference or an array:

$messages = $document->message;  # returns an array reference

$document->message( [ $msg1, $msg2 ] );
$document->message( [ $msg ] );
$document->message( $msg1, $msg2);
$document->message( $msg );

To append a message you can use the add or the addMessage method:

$document->add( $msg );         # $msg must be a DAIA::Message
$document->addMessage( ... );   # ... is passed to message constructor

FUNCTIONS

is_language_tag ( $tag )

Returns whether $tag is a formally valid language tag. The regular expression follows XML Schema type xs:language instead of RFC 3066. For true RFC 3066 support have a look at I18N::LangTags.

AUTHOR

Jakob Voß

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Jakob Voß.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.