Chronic

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

      in certain cases.

    - Added a template constraint module under the docs
      directory. The template will act as a starting point for
      writing new constraints.


0.10 (May 15, 2004)

    - Introduced a Xscreensaver constraint that is met when
      Xscreensaver is locked for a specified amount of time.
      chronicd manpage updated with Xscreensaver documentation.
      [Feature Request #952966]

    - Added a basic use test to satisfy CPAN's automated
      testing. A more comprehensive test suite will be
      provided someday.


0.02 (May 11, 2004)

docs/chronicd.pod  view on Meta::CPAN

    command = "/usr/bin/updatedb"; constraint = DiskIO, 60, 0, 0; \
        constraint = Freq, 3600;

=item The B<Xscreensaver> Constraint

The B<Xscreensaver> constraints asynchronously monitors
Xscreensaver through the B<xscreensaver-command> program. It
accepts one parameter: the number of seconds for which
B<Xscreensaver> must be enabled before the constraint is met.
The syntax for the constraint is B<Xscreensaver, TIME>. eg.
B<Xscreensaver, 120> is met when B<Xscreensaver> is locked for
120 or more seconds. The constraint is considered to be met
until the screensaver is unlocked. Here's an example of usage:

    command = "emerge rsync"; Constraint = Xscreensaver, 120; \
        constraint = Freq, 86400;

=item The B<InXs> Constraint

The B<InXs> constraint (unrelated to the POP band) combines the
Xscreensaver and Inactivity constraints. It is met when
B<either> of the constraints is met. B<InXs> is useful for
scheduling high-load applications on end-user machines because

lib/Schedule/Chronic/Constraint/Xscreensaver.pm  view on Meta::CPAN



sub met { 

    my ($self) = @_;

    my $state = $self->state();

    # $state values: 
    # 0 means no change
    # 1 means toggled to locked
    # 2 means toggled to unlocked

    my @states = ('NO CHANGE', 'LOCKED', 'UNLOCKED');

    $self->debug("  xscreensaver state = $states[$state]");

    if ($$self{timer}->running() and $state == 0) { 
        
        # We are still in locked mode.

        if ($$self{timer}->get() <= 0) { 
            return 1;
        } else { 
            $$self{wait} = $$self{timer}->get();
            $self->debug("  xscreensaver locked, " . $$self{timer}->get() . " seconds remain.");
            return 0;
        }

    }

    if ($$self{timer}->running() and $state == 2) { 

        # In unlocked mode.

        $$self{wait} = 5;
        $$self{timer}->stop();
        return 0;

    } 


    if (!$$self{timer}->running() and $state == 1) { 

        # Toggled into locked mode.

        $$self{timer}->set($$self{active});
        $$self{wait} = 0;
        return 0;

    }

    return 0;

}



( run in 0.730 second using v1.01-cache-2.11-cpan-49f99fa48dc )