use 5.020;
use strict;
use warnings;
package My::Dog::Rex;
use Net::DBus::Exporter qw(org.my.rex.Runner);
use base qw(Net::DBus::Object);
# use Rex -feature => [qw/1.4/];
dbus_method("walk_dog", [], []);
sub walk_dog {
my $self = shift;
say "Walking the dog";
# user "root";
# password "ch4ngem3";
#
# desc "Show system information";
# task "sysinfo", sub {
# say run "uname -a";
# };
}
1;
package My::Rex::Service;
use base qw(Net::DBus::Service);
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
My::Dog::Rex->new($self, "/my/dog/rex");
return $self;
}
package main;
use Net::DBus;
use Net::DBus::Reactor;
my $bus = Net::DBus->session;
my $rex = My::Rex::Service->new($bus, "org.my.rex");
Net::DBus::Reactor->main->run;
exit 0;
####
use 5.020;
use strict;
use warnings;
use Net::DBus;
my $bus = Net::DBus->session;
my $rex = $bus->get_service("org.my.rex")->get_object("/my/dog/rex");
$rex->walk_dog;
##
##