Net::Trackback::Message - an object representing a Trackback message.
use Net::Trackback::Message;
my $msg = Net::Trackback::Message->new();
$msg->code(1);
$msg->message("Live and let foo.")
print $msg->to_xml;
print $msg->is_success ? 'go.' : 'stop!';
- Net::Trackback::Message->new([$hashref])
- Constuctor method. It will initialize the object if passed a hash
reference. Recognized keys are code and message. These keys correspond to
the methods like named methods.
- Net::Trackback::Message->parse($xml)
- A method that parses (albeit crude using regex) a Trackback message and
returns a message object. In the event a bad or incomplete message has
been passed in the method will return
"undef". The error message can be
retreived with the "errstr" method. One
required parameter, a string containing the message XML.
- $msg->code([$int])
- An accessor to the message code, an integer. If an optional parameter is
passed in the value is set.
The Trackback specification only defines to codes 0 (success)
and 1 (error). This module takes the liberty of passing an HTTP error
code instead of just a 1 if one occurs during processing.
- $msg->message([$message])
- An accessor to the body of the message. If an optional parameter is passed
in the value is set.
The Trackback specification does not define specific message
strings. They are generally treated as text to display or log. The
message body is not required when sending especially when it is a
successful (code 0) ping, but its a good idea to include as informative
a message as possible.
- $msg->is_success
- Returns a boolean value indicating whether the message object represents a
successful ping or not.
- $msg->is_error
- Returns a boolean value indicating whether the message object represents
an error while pinging or not.
- $msg->to_hash
- Returns a hash of the object's current state.
- $msg->to_xml
- Returns an XML representation of the Trackback message that can be sent as
a response to a client.
This module is a subclass of Class::ErrorHandler and inherits two methods for
passing error message back to a caller.
- Class->error($message)
- $object->error($message)
- Sets the error message for either the class Class or the object
$object to the message
$message. Returns undef.
- Class->errstr
- $object->errstr
- Accesses the last error message set in the class Class or the object
$object, respectively, and returns that error
message.
Please see the Net::Trackback manpage for author, copyright, and license
information.
Hey! The above document had some coding errors, which are explained
below:
- Around line 52:
- =begin without a target?
- Around line 69:
- '=item' outside of any '=over'
- Around line 122:
- You forgot a '=back' before '=head2'
- Around line 127:
- '=item' outside of any '=over'
- Around line 141:
- You forgot a '=back' before '=head1'
- Around line 148:
- '=end' without a target?