Revision history for Perl extension Catalyst::Plugin::Scheduler
+0.03 2005-12-15 16:00:00
+ - Fixed yaml_file option.
+
0.02 2005-12-15 15:40:00
- Fixed pod coverage.
- Hide timezone warning unless logging is enabled.
use Storable qw/lock_store lock_retrieve/;
use YAML;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
__PACKAGE__->mk_classdata( '_events' => [] );
__PACKAGE__->mk_accessors('_event_state');
$c->config->{scheduler}->{time_zone} ||= $c->_detect_timezone();
$c->config->{scheduler}->{state_file} ||= $c->path_to('scheduler.state');
$c->config->{scheduler}->{hosts_allow} ||= '127.0.0.1';
- $c->config->{scheduler}->{yaml} ||= $c->path_to('scheduler.yml');
+ $c->config->{scheduler}->{yaml_file} ||= $c->path_to('scheduler.yml');
$c->NEXT::setup(@_);
}
return if ( time - $c->_event_state->{last_check} < 60 );
}
- return unless -e $c->config->{scheduler}->{yaml};
+ return unless -e $c->config->{scheduler}->{yaml_file};
eval {
- my $mtime = ( stat $c->config->{scheduler}->{yaml} )->mtime;
+ my $mtime = ( stat $c->config->{scheduler}->{yaml_file} )->mtime;
if ( $mtime > $c->_event_state->{yaml_mtime}->{$$} ) {
$c->_event_state->{yaml_mtime}->{$$} = $mtime;
$c->_save_event_state();
# wipe out all current events and reload from YAML
$c->_events( [] );
- my $yaml = YAML::LoadFile( $c->config->{scheduler}->{yaml} );
+ my $yaml = YAML::LoadFile( $c->config->{scheduler}->{yaml_file} );
foreach my $event ( @{$yaml} ) {
$c->schedule( %{$event} );
=head2 schedule
Schedule is a class method for adding scheduled events. See the
-L<"/SCHEDULING> section for more information.
+L<"/SCHEDULING"> section for more information.
=head1 INTERNAL METHODS
lock_store $state, $STATE;
# configure a yaml file
-TestApp->config->{scheduler}->{yaml} = "$FindBin::Bin/lib/TestApp/test.yml";
+TestApp->config->{scheduler}->{yaml_file}
+ = "$FindBin::Bin/lib/TestApp/test.yml";
# test that the plugin event executes
{