Net::DBus::Service(3)

πŸ’– Net::DBus::Service(3) β€” the Perl manpage, but make it cute πŸ’–

okay so bestie, this is Net::DBus::Service from the User Contributed Perl Documentation collection, and honestly? it's giving "small module, big main character energy." it's the thing that lets your Perl code claim a name on the message bus so other people's programs can talk to it. iconic behaviour, no cap. πŸ¦‹


✨ NAME ✨

Net::DBus::Service β€” bestie, this is literally the module that provides a service to the bus for clients to use. that's the whole gig. πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe in code form, exactly as written:

  package main;

  use Net::DBus;

  # Attach to the bus
  my $bus = Net::DBus->find;

  # Acquire a service 'org.demo.Hello'
  my $service = $bus->export_service("org.demo.Hello");

  # Export our object within the service
  my $object = Demo::HelloWorld->new($service);

  ....rest of program...

so you hop on the bus, you grab a service name (org.demo.Hello in this case), and then you start yeeting objects into it. slay. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: this module represents a service which is exported to the message bus. and once a service has been exported? that's when the fun starts β€” it becomes possible to create and export objects to the bus. the service is like the lil container, and the objects are the actual things people come to visit. iykyk. 🫢


πŸ”₯ METHODS πŸ”₯

my $service = Net::DBus::Service->new($bus, $name);

creates a shiny new service and latches it onto the bus you passed in via the $bus parameter β€” which should be an instance of the Net::DBus object, just so we're clear. the $name parameter is the qualified service name.

and ngl, you usually don't need to call this constructor yourself, because services can be created through the "export_service" method on the Net::DBus object instead. it's giving "there's a shortcut, take it." 😌

⭐ tiny but important detail: when $name is not specified or is "undef", the handle you get back to the service is identified only by the unique name of the client's connection to the bus. so no fancy qualified name for you β€” just the unique one. πŸ™ˆ

my $bus = $service->get_bus;

hands you back the Net::DBus object that this service is attached to. it's like asking "who's your bus bestie?" and getting a real answer. 🚌

my $name = $service->get_service_name

gives you the qualified name by which this service is known on the bus. the whole government name, basically. πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Daniel P. Berrange β€” the legend behind it all. 🫑


Copyright (C) 2005-2011 Daniel P. Berrange


🌈 SEE ALSO 🌈

  • Net::DBus
  • Net::DBus::Object
  • Net::DBus::RemoteService

go read those next, bestie, they're the rest of the friend group fr fr. πŸ’œ


and that's a wrap! this page came to you courtesy of perl v5.42.0, dated 2019-12-17, and it's the Net::DBus::Service(3) manpage β€” periodt. πŸ’–βœ¨