Net::DB...seObject(3)
π¦ Net::DBus::BaseObject π¦
Okay bestie, welcome to the <pink>User Contributed Perl Documentation</pink> page for Net::DB...seObject(3) β we are officially in the <purple>base class for exporting objects to the bus</purple> zone. Let's go. π
β¨ NAME β¨
Net::DBus::BaseObject β <hotpink>base class for exporting objects to the bus</hotpink>. That's it, that's the name, and it's iconic. π
πΈ SYNOPSIS πΈ
# We're going to be a DBus object
use base qw(Net::DBus::BaseObject);
# Export a 'Greeting' signal taking a stringl string parameter
dbus_signal("Greeting", ["string"]);
# Export 'Hello' as a method accepting a single string
# parameter, and returning a single string value
dbus_method("Hello", ["string"], ["string"]);
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/org/demo/HelloWorld");
bless $self, $class;
return $self;
}
sub _dispatch_object {
my $self = shift;
my $connection = shift;
my $message = shift;
if (....$message refers to a object's method ... ) {
...dispatch this object's interfaces/methods...
return $reply;
}
}
The comment says stringl and we are keeping it exactly as written β canon. π
π§ DESCRIPTION π§
This is the base of all objects which are exported to the message bus. It provides the core support for type introspection required for objects exported to the message. When sub-classing this object, the _dispatch object should be implemented to handle processing of incoming messages. The Net::DBus::Exporter module is used to declare which methods (and signals) are being exported to the message bus. <rainbow>No cap.</rainbow> β¨
All packages inheriting from this automatically have the interface org.freedesktop.DBus.Introspectable registered with Net::DBus::Exporter, and the Introspect method within this exported. Periodt. π
Application developers will rarely want to use this class directly β instead either Net::DBus::Object or Net::DBus::ProxyObject are the common choices. This class will only be used if wanting to write a new approach to dispatching incoming method calls. Iykyk. π¦
π οΈ METHODS π οΈ
my $object = Net::DBus::BaseObject->new($service, $path)β creates a new DBus object with an path of$pathregistered within the service$service. The$pathparameter should be a string complying with the usual DBus requirements for object paths, while the$serviceparameter should be an instance ofNet::DBus::Service. The latter is typically obtained by calling theexport_servicemethod on theNet::DBusobject. Slay. πmy $object = Net::DBus::BaseObject->new($parentobj, $subpath)β creates a new DBus child object with an path of$subpathrelative to its parent$parentobj. The$subpathparameter should be a string complying with the usual DBus requirements for object paths, while the$parentobjparameter should be an instance ofNet::DBus::BaseObject. Child-object moment. π«Ά$object->disconnect();β disconnects the object from the bus, such that it will no longer receive messages sent by other clients. Any child objects will be recursively disconnected too. After an object has been disconnected, it is possible for Perl to garbage collect the object instance. It will also make it possible to connect a newly created object to the same path.<mint>Cleanup era.</mint>π§Ήmy $bool = $object->is_connectedβ returns a true value if the object is connected to the bus, and thus capable of being accessed by remote clients. Returns false if the object is disconnected & thus ready for garbage collection. All objects start off in the connected state, and will only transition if thedisconnectmethod is called. Vibe check: are you connected or not? βmy $service = $object->get_serviceβ retrieves theNet::DBus::Serviceobject within which this object is exported. πmy $path = $object->get_object_pathβ retrieves the path under which this object is exported. π$object->emit_signal_in($name, $interface, $client, @args);β emits a signal from the object, with a name of$name. If the$interfaceparameter is defined, the signal will be scoped within that interface. If the$clientparameter is defined, the signal will be unicast to that client on the bus. The signal and the data types of the arguments@argsmust have been registered withNet::DBus::Exporterby calling thedbus_signalmethod. Scoped, unicast, registered β the whole signal situation. π‘$self->emit_signal_to($name, $client, @args);β emits a signal from the object, with a name of$name. The signal and the data types of the arguments@argsmust have been registered withNet::DBus::Exporterby calling thedbus_signalmethod. The signal will be sent only to the client named by the$clientparameter. Direct message, but make it a signal. π$self->emit_signal($name, @args);β emits a signal from the object, with a name of$name. The signal and the data types of the arguments@argsmust have been registered withNet::DBus::Exporterby calling thedbus_signalmethod. The signal will be broadcast to all clients on the bus. Main-character broadcast energy. π₯$object->connect_to_signal_in($name, $interface, $coderef);β connects a callback to a signal emitted by the object. The$nameparameter is the name of the signal within the object, and$coderefis a reference to an anonymous subroutine. When the signal$nameis emitted by the remote object, the subroutine$coderefwill be invoked, and passed the parameters from the signal. The$interfaceparameter is used to specify the explicit interface defining the signal to connect to. πͺ$object->connect_to_signal($name, $coderef);β connects a callback to a signal emitted by the object. The$nameparameter is the name of the signal within the object, and$coderefis a reference to an anonymous subroutine. When the signal$nameis emitted by the remote object, the subroutine$coderefwill be invoked, and passed the parameters from the signal. Same callback energy, no explicit interface parameter. π«Ά$reply = $object->_dispatch_object($connection, $message);β the_dispatch_objectmethod is to be used to handle dispatch of methods implemented by the object. The default implementation is a no-op and should be overridden by subclasses todo whatever processing is required. If the$messagecould be handled then anotherNet::DBus::Binding::Messageinstance should be returned for the reply. Ifundefis returned, then a generic error will be returned to the caller. Yes, the wordtodois living there rent-free β we keep it. π$currvalue = $object->_dispatch_property($name);/$object->_dispatch_property($name, $newvalue);β the original has a stray=itemwedged between these two signatures, and we are honoring the chaos:$currvalue = $object->_dispatch_property($name); =itemand then$object->_dispatch_property($name, $newvalue);. The_dispatch_propertymethod is to be used to handle dispatch of property reads and writes. The$nameparameter is the name of the property being accessed. If$newvalueis supplied then the property is to be updated, otherwise the current value is to be returned. The default implementation will simply raise an error, so must be overridden in subclasses. π«Ά
π AUTHOR π
Daniel P. Berrange. That's the author, and that's the moment. π
π COPYRIGHT π
Copyright (C) 2005-2011 Daniel P. Berrange. π
π SEE ALSO π
Net::DBusNet::DBus::ServiceNet::DBus::ObjectNet::DBus::ProxyObjectNet::DBus::ExporterNet::DBus::RemoteObject
Okay bestie, that's the whole page. It's from the User Contributed Perl Documentation and the Net::DB...seObject(3) manual name, and the footer says perl v5.42.0, dated 2019-12-17. Mwah. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: perl-Net-DBus 1.2.0-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms