Padre::Wx::Role::Conduit

Padre::Wx::Role::ConduUserpContributed Perl DocumPadre::Wx::Role::Conduit(3pm)



NAME
       Padre::Wx::Role::Conduit - Role to allow an object to receive Wx events

SYNOPSIS
         package My::MainFrame;

         use strict;
         use Padre::Wx                ();
         use Padre::Wx::Role::Conduit ();
         use My::ChildHandler         ();

         our @ISA = qw{
             Padre::Wx::Role::Conduit
             Wx::Frame
         };

         sub new {
             my $class = shift;
             my $self  = $class->SUPER::new(@_);

             # Register to receive events
             $self->conduit_init( My::ChildHander->singleton );

             return $self;
         }

DESCRIPTION
       This role provides the functionality needed to receive
       Wx::PlThreadEvent objects from child threads.

       You should only use this role once and once only in the parent process,
       and then allow that single event conduit to pass the events on to the
       other parts of your program, or to some dispatcher object that will do
       so.

       It is implemented as a role so that the functionality can be used
       across the main process and various testing classes (and will be easier
       to turn into a CPAN spinoff later).

PARENT METHODS
   conduit_init
         $window->conduit_init($handler);

       The "conduit_init" method is called on the parent receiving object once
       it has been created.

       It takes the handler that deserialised messages should be passed to
       once they have been extracted from the incoming Wx::PlThreadEvent and
       deserialised into a message structure.

   handler
         $window->handler($handler);

       The "handler" accessor is a convenience method that allows you to
       change the message handler after the conduit has been initialised.

   on_signal
         $window->on_signal( $pl_thread_event );

       The "on_signal" method is called by the Wx system on the parent object
       when a Wx::PlThreadEvent arrives from a child thread.

       The default implementation will extra the packaged data for the event,
       deserialise it, and then pass off the "on_signal" method of the
       handler.

       You might overload this method if you need to something exotic with the
       event handling, but this is highly unlikely and this documentation is
       provided only for completeness.

   signal
         Padre::Wx::Role::Conduit->signal(
             Storable::freeze( [ 'My message' ] )
         );

       The static "signal" method is called in child threads to send a message
       to the parent window. The message can be any legal Perl structure that
       has been serialised by the Storable module.

COPYRIGHT & LICENSE
       Copyright 2008-2012 The Padre development team as listed in Padre.pm.

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl 5 itself.

       The full text of the license can be found in the LICENSE file included
       with this module.



perl v5.14.2                      2012-04-19     Padre::Wx::Role::Conduit(3pm)