App-MultiModule

 view release on metacpan or  search on metacpan

lib/App/MultiModule/Tasks/OutOfBand.pm  view on Meta::CPAN

package App::MultiModule::Tasks::OutOfBand;
$App::MultiModule::Tasks::OutOfBand::VERSION = '1.171870';
use strict;use warnings;
use Storable;
use Message::Match qw(mmatch);
use IPC::Transit;
use PadWalker qw(peek_my);

$Storable::Deparse = 1;
$Storable::Deparse = 1;
$Storable::Eval = 1;
$Storable::Eval = 1;

use parent 'App::MultiModule::Task';

=head2 message

No docs yet, sorry.

=cut
sub message {
#All debugging messages land here; if we are external, then we will
#re-send as a non-local send.  If we're on the parent, then we'll
#actually handle the debug stream.
    my $self = shift;
    my $oob_message = shift;
    my %args = @_;

    my $root_object = $args{root_object};
    if($root_object->{module} ne 'main') {
        #in this case, do a non-local Transit send so MultiModule parent
        #debug can pick it up
        IPC::Transit::send(
            qname => 'OutOfBand',
            message => $oob_message,
            override_local => 1);
        return;
    }
    my $type = $oob_message->{type};
    if(not $type) {
        $self->error(   "OutOfBand: message received with no 'type' field",
                        message => $oob_message);
        return;
    }
    my $filter_config;
    eval {
        $filter_config = $args{root_object}->{api}->get_task_state('MultiModule') or die;
        $filter_config = $filter_config->{OOB} or die;
        $filter_config = $filter_config->{$type} or die;
    };
    my $include_message = 0;
    if($filter_config and $filter_config->{include_matches}) {
        while(my($filter_name, $filter_def) = each %{$filter_config->{include_matches}}) {
            $include_message = 1 if mmatch($oob_message, $filter_def);
        }
    } else {
        $include_message = 1;
    }

    if($filter_config and $filter_config->{exclude_matches}) {
        while(my($filter_name, $filter_def) = each %{$filter_config->{exclude_matches}}) {
            $include_message = 0 if mmatch($oob_message, $filter_def);
        }
    }

    return unless $include_message;
    {   



( run in 2.191 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )