NAME

DAIA::Message - An optional information text

VERSION

version 0.35

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

This property is always undef no matter what you set it to.

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

$document += $msg;              # same as $document->add( $msg );

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 Voss

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jakob Voss.

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