Meeting: Tuesday 18th of January

perl at perl at
Tue Jan 18 22:28:34 PST 2011

On 18/01/2011 17:57, Andy Selby wrote:
> just to remind everyone, this is tonight!

Thanks all, for another fun and interesting social meeting :)

I mentioned setting up a plugin system to load at runtime a library
(e.g. what DBI does when you call connect with a DSN - it is loading
the MySQL/Pg/SQLite/etc driver, which implements a predefined API).

Moose users can deploy MooseX::Object::Pluggable to achieve this.

However for simple uses the code is not complex. In one of my
modules I have a "transport" which can be SSH, Telnet, Serial Line, etc:

sub BUILD {
    my ($self, $params) = @_;

    use Moose::Util;
        'Net::Appliance::Session::Transport::'. $self->transport);

The above code takes the name of the transport, provided by the user
in the {transport => 'Foo'} parameter to new(). It then composes the
role onto the current *instance*. We assume the transport provides
some predefined API to the application.



More information about the MiltonKeynes-pm mailing list