<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    AnyEvent::Processor - Base class to define an event-driven (AnyEvent)
    task that could periodically be interrupted by a watcher

VERSION
    version 0.005

SYNOPSIS
      package FridgeMonitoring;
  
      use Moose;
      extends 'AnyEvent::Processor';
      use TemperatureSensor;
  
      has sensors =&gt; (is =&gt; 'rw', isa =&gt; 'ArrayRef[TemperatureSensor]');
      has min =&gt; (is =&gt; 'rw', isa =&gt; 'Int', default =&gt; '10');
      has max =&gt; (is =&gt; 'rw', isa =&gt; 'Int', default =&gt; '20');
  
  
      sub process {
          my $self = shift;
  
          my @failed;
          for my $sensor ( @{$self-&gt;sensors} ) {
              next if $self-&gt;sensor-&gt;temperature &gt;= $self-&gt;min &amp;&amp;
                      $self-&gt;sensor-&gt;temperature &lt;= $self-&gt;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-&gt;count, "] Fridges testing";
      }

    package Main;

    use FridgeMonitoring;

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

DESCRIPTION
    A processor task based on this class process anything that can be
    divided into processing clusters. Each cluster is processed one by one
    by calling the process() method. A count is incremented at the end of
    each cluster. By default, a AnyEvent::Processor::Watcher is associated
    with the class, interrupting the processing each second for calling
    "process_message".

ATTRIBUTES
  verbose
    Verbose mode. In this mode an AnyEvent::Processor::Watcher is
    automatically created, with a 1s timeout, and action directly sent to
    this class. You can create your own watcher subclassing
    AnyEvent::Processor::Watcher.

  watcher
    An AnyEvent::Processor::Watcher.

  count
    Number of items which have been processed.

  blocking
    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.

  process_message
    Say something about the process. Called by default watcher (verbose
    mode) each 1s. By default, just display the "count" value. Your
    processor can display something else than just the number of processing
    clusters already processed. If your processor monitor the temperature of
    your fridge, you can display it...

  end_process
    Do something at the end of the process.

  end_message
    Say something at the end of the process. Called by default watcher.

SEE ALSO
    *   AnyEvent::Processor::Converion

    *   AnyEvent::Processor::Watcher

AUTHOR
    Fr矇d矇ric Demians &lt;f.demians@tamil.fr&gt;

COPYRIGHT AND LICENSE
    This software is Copyright (c) 2014 by Fr矇deric Demians.

    This is free software, licensed under:

      The GNU General Public License, Version 3, June 2007

POD ERRORS
    Hey! The above document had some coding errors, which are explained
    below:

    Around line 231:
        Unterminated L&lt;...&gt; sequence

    Around line 235:
        Unterminated L&lt;...&gt; sequence

</pre></body></html>