Jens Rehsack


Net::Radio::oFono::Roles::Manager - Role for Interfaces which manages objects


This package provides a role for being added to classes which need to manages embedded remote objects in remote dbus object.


    package Net::Radio::oFono::NewInterface;

    use Net::Radio::oFono::Roles::Manager qw(Embed);
    use base qw(Net::Radio::oFono::Helpers::EventMgr? Net::Radio::oFono::Roles::RemoteObj Net::Radio::oFono::Roles::Manager ...);

    use Net::DBus qw(:typing);

    sub new
        my ( $class, %events ) = @_;

        my $self = $class->SUPER::new(%events); # SUPER::new finds first - so EventMgr::new

        bless( $self, $class );


        return $self;

    sub _init
        my $self = $_[0];

        # initialize roles
        $self->Net::Radio::oFono::Roles::RemoteObj::_init( "/modem_0", "org.ofono.NewInterface" ); # must be first one
        $self->Net::Radio::oFono::Roles::Manager::_init( "Embed", "NewEmbed" );


    sub DESTROY
        my $self = $_[0];

        # destroy roles
        $self->Net::Radio::oFono::Roles::Manager::DESTROY(); # must be last one
        $self->Net::Radio::oFono::Roles::RemoteObj::DESTROY(); # must be last one

        # destroy base class



Following events are triggered by this role:

ON_ . uc($type) . _ADDED

Triggered when a new object of specified type was added.

ON_ . uc($type) . _REMOVED

Triggered when an object of specified type is removed.



When invoked, getters for embedded objects are injected into caller's namespace using the generic "GetObjects" and "GetObject" as well as required static methods for managed types.

Using the MessageManager example:

    package Net::Radio::oFono::MessageManager;
    use Net::Radio::oFono::Roles::Manager qw(Message);

Injects GetMessages and GetMessage into Net::Radio::oFono::MessageManager, using GetObjects for GetMessages and GetObject for GetMessage. Injects _get_managed_type and _get_managed_interface into Net::Radio::oFono::MessageManager, returning Message as descriptive type and Message as interface or class type, respectively.

    package Net::Radio::oFono::NetworkRegistration;
    use Net::Radio::oFono::Roles::NetworkRegistration qw(Operator NetworkOperator);

Injects GetOperators and GetOperator into Net::Radio::oFono::NetworkRegistration, using GetObjects for GetOperators and GetObject for GetOperator. Injects _get_managed_type and _get_managed_interface into Net::Radio::oFono::NetworkRegistration, returning Operator as descriptive type and NetworkOperator as interface or class type, respectively.



Initializes the manager role of the object.

$type and $<$interface> are the spoken type of the embedded object (for signals, events) and the remote interface name (without the org.ofono. prefix).

If no interface is named, the spoken type is used as interface name (which is pretty common, like for Modem or Message).

The initialization connects to the signals ${type}Added and ${type}Removed provided by oFono's manager objects.


Frees previously aquired resources like connected signals, list of managed objects (object_path).

Must be invoked before the RemoteObject role frees it's resources ...


Returns the managed objects of the remote object as hash with the object path as key and the properties dictionary (hash) as value.

When invoked with a true value as first argument, the managed object list is refreshed from the remote object.

Returns the object hash in array more and the reference to the object hash in scalar mode.


Return cloned objects to avoid dirtying the local cache ...


Returns an instance of the managed object interface identified by the specified object path.

Take above example for MessageManager, this method will return instances of net::Radio::oFono::Message using the /{modem0,modem1,...}/{message_01,...} object path.


Callback method used when the signal ..Added is received. Can be overwritten to implement other or enhanced behavior.

  • Updates properties cache

  • Triggers event for added object


Callback method used when the signal ..Removed is received. Can be overwritten to implement other or enhanced behavior.

  • Updates properties cache

  • Triggers event for removed object


Please report any bugs or feature requests to bug-net-radio-ofono at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

If you think you've found a bug then please read "How to Report Bugs Effectively" by Simon Tatham:


You can find documentation for this module with the perldoc command.

    perldoc Net::Radio::oFono

You can also look for information at:

Where can I go for help with a concrete version?

Bugs and feature requests are accepted against the latest version only. To get patches for earlier versions, you need to get an agreement with a developer of your choice - who may or not report the issue and a suggested fix upstream (depends on the license you have chosen).

Business support and maintenance

For business support you can contact Jens via his CPAN email address Please keep in mind that business support is neither available for free nor are you eligible to receive any support based on the license distributed with this package.


At first the guys from the oFono-Team shall be named: Marcel Holtmann and Denis Kenzior, the maintainers and all the people named in ofono/AUTHORS. Without their effort, there would no need for a Net::Radio::oFono module.

Further, Peter "ribasushi" Rabbitson helped a lot by providing hints and support how to make this API accessor a valuable CPAN module.


Jens Rehsack, <rehsack at>


Copyright 2012 Jens Rehsack.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.