Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::dbus::error(3pm) [debian man page]

Net::DBus::Error(3pm)					User Contributed Perl Documentation				     Net::DBus::Error(3pm)

NAME
Net::DBus::Error - Error details for remote method invocation SYNOPSIS
package Music::Player::UnknownFormat; use base qw(Net::DBus::Error); # Define an error type for unknown track encoding type # for a music player service sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(name => "org.example.music.UnknownFormat", message => "Unknown track encoding format"); } package Music::Player::Engine; ...snip... # Play either mp3 or ogg music tracks, otherwise # thrown an error sub play { my $self = shift; my $url = shift; if ($url =~ /.(mp3|ogg)$/) { ...play the track } else { die Music::Player::UnknownFormat->new(); } } DESCRIPTION
This objects provides for strongly typed error handling. Normally a service would simply call die "some message text" When returning the error condition to the calling DBus client, the message is associated with a generic error code or "org.freedesktop.DBus.Failed". While this suffices for many applications, occasionally it is desirable to be able to catch and handle specific error conditions. For such scenarios the service should create subclasses of the "Net::DBus::Error" object providing in a custom error name. This error name is then sent back to the client instead of the genreic "org.freedesktop.DBus.Failed" code. METHODS
my $error = Net::DBus::Error->new(name => $error_name, message => $description); Creates a new error object whose name is given by the "name" parameter, and long descriptive text is provided by the "message" parameter. The "name" parameter has certain formatting rules which must be adhered to. It must only contain the letters 'a'-'Z', '0'-'9', '-', '_' and '.'. There must be at least two components separated by a '.', For example a valid name is 'org.example.Music.UnknownFormat'. $error->name Returns the DBus error name associated with the object. $error->message Returns the descriptive text/message associated with the error condition. $error->stringify Formats the error as a string in a manner suitable for printing out / logging / displaying to the user, etc. AUTHOR
Daniel P. Berrange COPYRIGHT
Copyright (C) 2005-2011 Daniel P. Berrange SEE ALSO
Net::DBus, Net::DBus::Object perl v5.14.2 2011-06-30 Net::DBus::Error(3pm)

Check Out this Related Man Page

Net::DBus::RemoteObject(3pm)				User Contributed Perl Documentation			      Net::DBus::RemoteObject(3pm)

NAME
Net::DBus::RemoteObject - Access objects provided on the bus SYNOPSIS
my $service = $bus->get_service("org.freedesktop.DBus"); my $object = $service->get_object("/org/freedesktop/DBus"); print "Names on the bus { "; foreach my $name (sort @{$object->ListNames}) { print " ", $name, " "; } print "} "; DESCRIPTION
This module provides the API for accessing remote objects available on the bus. It uses the autoloader to fake the presence of methods based on the API of the remote object. There is also support for setting callbacks against signals, and accessing properties of the object. METHODS
my $object = Net::DBus::RemoteObject->new($service, $object_path[, $interface]); Creates a new handle to a remote object. The $service parameter is an instance of the Net::DBus::RemoteService method, and $object_path is the identifier of an object exported by this service, for example "/org/freedesktop/DBus". For remote objects which implement more than one interface it is possible to specify an optional name of an interface as the third parameter. This is only really required, however, if two interfaces in the object provide methods with the same name, since introspection data can be used to automatically resolve the correct interface to call cases where method names are unique. Rather than using this constructor directly, it is preferrable to use the "get_object" method on Net::DBus::RemoteService, since this caches handles to remote objects, eliminating unneccessary introspection data lookups. my $object = $object->as_interface($interface); Casts the object to a specific interface, returning a new instance of the Net::DBus::RemoteObject specialized to the desired interface. It is only neccessary to cast objects to a specific interface, if two interfaces export methods or signals with the same name, or the remote object does not support introspection. my $service = $object->get_service Retrieves a handle for the remote service on which this object is attached. The returned object is an instance of Net::DBus::RemoteService my $path = $object->get_object_path Retrieves the unique path identifier for this object within the service. my $object = $object->get_child_object($subpath, [$interface]) Retrieves a handle to a child of this object, identified by the relative path $subpath. The returned object is an instance of "Net::DBus::RemoteObject". The optional $interface parameter can be used to immediately cast the object to a specific type. my $sigid = $object->connect_to_signal($name, $coderef); Connects a callback to a signal emitted by the object. The $name parameter is the name of the signal within the object, and $coderef is a reference to an anonymous subroutine. When the signal $name is emitted by the remote object, the subroutine $coderef will be invoked, and passed the parameters from the signal. A unique $sigid will be returned, which can be later passed to "disconnect_from_signal" to remove the handler $object->disconnect_from_signal($name, $sigid); Disconnects from a signal emitted by the object. The $name parameter is the name of the signal within the object. The $sigid must be the unique signal handler ID returned by a previous "connect_to_signal" method call. AUTHOR
Daniel Berrange <dan@berrange.com> COPYRIGHT
Copright (C) 2004-2011, Daniel Berrange. SEE ALSO
Net::DBus::RemoteService, Net::DBus::Object perl v5.14.2 2011-06-30 Net::DBus::RemoteObject(3pm)
Man Page