Skip Menu |
 

This queue is for tickets about the Config-Crontab CPAN distribution.

Report information
The Basics
Id: 6376
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Config-Crontab

People
Owner: Nobody in particular
Requestors: mailms [...] mszet.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.03
Fixed in: (no value)



Subject: Select method with -type => 'event' returns comments.
Download (untitled) / with headers
text/plain 978b
Hallo Scott I send you a bug report of a minior bug in your Config::Crontab module. The select-method of Config::Crontab called with -type => 'event' also returns comments in some cases. Look at the following example: michael@merkur:~/workspace/nvstart$ cat test.pl #!/usr/bin/perl use strict; use warnings; use Config::Crontab; my $ct = new Config::Crontab; $ct->strict(1); $ct->file("example.cron"); $ct->read; my @events = $ct->select( -type => 'event', -command_re => "/bin/nvjob"); foreach my $event (@events) { print $event->dump(), "\n"; } michael@merkur:~/workspace/nvstart$ cat example.cron # 25 23 * * * root /bin/nvjob hhhh 25 23 * * 0 root /bin/nvjob hhhh michael@merkur:~/workspace/nvstart$ perl test.pl #25 23 * * * root /bin/nvjob hhhh 25 23 * * 0 root /bin/nvjob hhhh In my opinion, the first line should not be printed, because its a comment. Thank you for your attention. with greetings Michael Strauß
Download (untitled) / with headers
text/plain 1.3k
[guest - Fri May 21 06:20:26 2004]: Show quoted text
> Hallo Scott > > I send you a bug report of a minior bug in your Config::Crontab > module. > > The select-method of Config::Crontab called with -type => 'event' also > returns comments in some cases. > > Look at the following example: > > michael@merkur:~/workspace/nvstart$ cat test.pl > #!/usr/bin/perl > > use strict; > use warnings; > > use Config::Crontab; > > my $ct = new Config::Crontab; > $ct->strict(1); > $ct->file("example.cron"); > $ct->read;
Hi Michael, You're correct that the line: Show quoted text
> # 25 23 * * * root /bin/nvjob hhhh
could be considered a comment. However, Config::Crontab treats it as an "inactive event" since it parses the same as an event (though it is commented out). This way, you can selectively disable/enable crontab event lines or play with them in other ways whether they are active or inactive events. To select only active events, change this: Show quoted text
> my @events = $ct->select( -type => 'event', > -command_re => "/bin/nvjob");
to this: my @events = $ct->select( -type => 'event', -command_re => "/bin/nvjob", -active => 1 ); I think I'll update the documentation to make that plainer than it is. As always, if you disagree with the design, I'm willing to re-evaluate it. Thanks for your feedback, Scott Wiersdorf


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.