AnyEvent-Processor

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

                      $self->sensor->temperature <= $self->max;
              push @failed, $sensor;
          }
          if ( @failed ) {
              # Send an email to someone with the list of failed fridges
          }
      }
  
      sub process_message {
          my $self = shift;
          say "[", $self->count, "] Fridges testing";
      }

    package Main;

    use FridgeMonitoring;

    my $processor = FridgeMonitoring->new( sensors => # Get a list of fridge
    sensors from somewhere min => 0, max => 40, ); $processor->run();

DESCRIPTION

README  view on Meta::CPAN

    Is it a blocking task (not a task). False by default.

METHODS
  run
    Run the process.

  start_process
    Something to do at beginning of the process.

  start_message
    Something to say about the process. Called by default watcher when
    verbose mode is enabled. By default, just send to STDOUT 'Start
    process...'. Your class can display another message, or do something
    else, like sending an email, or a notification to a monitoring system
    like Nagios.

  process
    Process something and increment count. This method has to be surclassed
    by you class if you want to do someting else than incrementing the
    "count" attribute.

lib/AnyEvent/Processor.pm  view on Meta::CPAN

        }
    });
    $end_run->recv;
}


sub start_process { }


sub start_message {
    say "Start process";
}


sub process {
    my $self = shift;
    $self->count( $self->count + 1 );
    return 1;
}


sub process_message {
    my $self = shift;
    say sprintf("  %#6d", $self->count);    
}


sub end_process { return 0; }


sub end_message {
    my $self = shift; 
    say "Number of items processed: ", $self->count;
}


no Moose;
__PACKAGE__->meta->make_immutable;

1;

__END__

lib/AnyEvent/Processor.pm  view on Meta::CPAN

                  $self->sensor->temperature <= $self->max;
          push @failed, $sensor;
      }
      if ( @failed ) {
          # Send an email to someone with the list of failed fridges
      }
  }
  
  sub process_message {
      my $self = shift;
      say "[", $self->count, "] Fridges testing";
  }

package Main;

use FridgeMonitoring;

my $processor = FridgeMonitoring->new(
    sensors => # Get a list of fridge sensors from somewhere
    min => 0,
    max => 40,

lib/AnyEvent/Processor.pm  view on Meta::CPAN

=head2 run

Run the process.

=head2 start_process

Something to do at beginning of the process.

=head2 start_message

Something to say about the process. Called by default watcher when verbose mode
is enabled. By default, just send to STDOUT 'Start process...'. Your class can
display another message, or do something else, like sending an email, or a
notification to a monitoring system like Nagios.

=head2 process

Process something and increment L<count>. This method has to be surclassed by
you class if you want to do someting else than incrementing the C<count>
attribute.



( run in 2.639 seconds using v1.01-cache-2.11-cpan-483215c6ad5 )