r25910 - in /trunk/libschedule-at-perl: At.pm Changes META.yml debian/changelog t/t1.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Fri Oct 10 12:59:41 UTC 2008
Author: gregoa
Date: Fri Oct 10 12:59:38 2008
New Revision: 25910
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=25910
Log:
New upstream release.
Modified:
trunk/libschedule-at-perl/At.pm
trunk/libschedule-at-perl/Changes
trunk/libschedule-at-perl/META.yml
trunk/libschedule-at-perl/debian/changelog
trunk/libschedule-at-perl/t/t1.t
Modified: trunk/libschedule-at-perl/At.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libschedule-at-perl/At.pm?rev=25910&op=diff
==============================================================================
--- trunk/libschedule-at-perl/At.pm (original)
+++ trunk/libschedule-at-perl/At.pm Fri Oct 10 12:59:38 2008
@@ -2,13 +2,13 @@
require 5.004;
-# Copyright (c) 1997-2006 Jose A. Rodriguez. All rights reserved.
+# Copyright (c) 1997-2008 Jose A. Rodriguez. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
use vars qw($VERSION @ISA $TIME_FORMAT);
-$VERSION = '1.07';
+$VERSION = '1.08';
###############################################################################
# Load configuration for this OS
@@ -39,6 +39,7 @@
sub add {
my %params = @_;
+ my $cmd;
my $command = $AT{($params{FILE} ? 'addFile' : 'add')};
return &$command($params{JOBID}) if ref($command) eq 'CODE';
@@ -53,7 +54,10 @@
} else {
open (ATCMD, "| $command") or return 1;
print ATCMD "$TAGID$params{TAG}\n" if $params{TAG};
- print ATCMD $params{COMMAND};
+
+ print ATCMD ref($params{COMMAND}) eq "ARRAY" ?
+ join("\n", @{$params{COMMAND}}) : $params{COMMAND};
+
close (ATCMD);
}
@@ -202,6 +206,7 @@
require Schedule::At;
Schedule::At::add(TIME => $string, COMMAND => $string [, TAG =>$string]);
+ Schedule::At::add(TIME => $string, COMMAND => \@array [, TAG =>$string]);
Schedule::At::add(TIME => $string, FILE => $string)
%jobs = Schedule::At::getJobs();
@@ -226,26 +231,26 @@
Adds a new job to the at queue.
You have to specify a B<TIME> and a command to execute. The B<TIME> has
-a common format: YYYYMMDDHHmm. Where B<YYYY> is the year (4 digits), B<MM>
+a common format: YYYYMMDDHHmm where B<YYYY> is the year (4 digits), B<MM>
the month (01-12), B<DD> is the day (01-31), B<HH> the hour (00-23) and
B<mm> the minutes.
The command is passed with the B<COMMAND> or the B<FILE> parameter.
-B<COMMAND> can be used to pass the command as an string, and B<FILE> to
-read the commands from a file.
+B<COMMAND> can be used to pass the command as an string, or an array of
+commands, and B<FILE> to read the commands from a file.
The optional parameter B<TAG> serves as an application specific way to
identify a job or a set of jobs.
Returns 0 on success or a value != 0 if an error occurred.
-=item Schedule::At::readJob
+=item Schedule::At::readJobs
Read the job content identified by the B<JOBID> or B<TAG> parameters.
-Returns an string with the job content. As the operating systems usually
-add a few environment settings, the content is longer than the command
-provided when adding the job.
+Returns a hash of JOBID => $string where $string is the the job
+content. As the operating systems usually add a few environment settings,
+the content is longer than the command provided when adding the job.
=item Schedule::At::remove
@@ -293,10 +298,12 @@
Schedule::At::add (TIME => '199801181530', COMMAND => 'ls',
TAG => 'ScheduleAt');
# 2
- Schedule::At::add (TIME => '199801181630', COMMAND => 'ls',
+ @cmdlist = ("ls", "echo hello world");
+
+ Schedule::At::add (TIME => '199801181630', COMMAND => \@cmdlist,
TAG => 'ScheduleAt');
# 3
- Schedule::At::add (TIME => '199801181730', COMMAND => 'ls');
+ Schedule::At::add (TIME => '199801181730', COMMAND => 'df');
# This will remove #1 and #2 but no #3
Schedule::At::remove (TAG => 'ScheduleAt');
Modified: trunk/libschedule-at-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libschedule-at-perl/Changes?rev=25910&op=diff
==============================================================================
--- trunk/libschedule-at-perl/Changes (original)
+++ trunk/libschedule-at-perl/Changes Fri Oct 10 12:59:38 2008
@@ -45,3 +45,13 @@
- Fixed typo in pod (Michael Gang" <michaelgang AT gmail.com>)
- remove function using TAG now returns something useful (pointed by
<T.Haecker AT gmx.net>)
+
+1.08 Thu Oct 9 07:53:30 MEST 2008
+ - Fixed typos and improve explanations in pod
+ (Adam Benjamin <aebenjam AT opentext.com>)
+ - addJob now accepts multiple commands as a REF ARRAY
+ (implemented by Adam Benjamin <aebenjam AT opentext.com>)
+ - Many systems don't allow users to execute the "at" command
+ so tests fail. Now you need to set environment AT_CAN_EXEC=1
+ to exec all tests if you're not root. Set AT_VERBOSE=1 to
+ get more info about test execution.
Modified: trunk/libschedule-at-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libschedule-at-perl/META.yml?rev=25910&op=diff
==============================================================================
--- trunk/libschedule-at-perl/META.yml (original)
+++ trunk/libschedule-at-perl/META.yml Fri Oct 10 12:59:38 2008
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Schedule-At
-version: 1.07
+version: 1.08
version_from: At.pm
installdirs: site
requires:
Modified: trunk/libschedule-at-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libschedule-at-perl/debian/changelog?rev=25910&op=diff
==============================================================================
--- trunk/libschedule-at-perl/debian/changelog (original)
+++ trunk/libschedule-at-perl/debian/changelog Fri Oct 10 12:59:38 2008
@@ -1,3 +1,9 @@
+libschedule-at-perl (1.08-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org> Fri, 10 Oct 2008 14:57:58 +0200
+
libschedule-at-perl (1.07-1) unstable; urgency=low
[ Vincent Danjean ]
Modified: trunk/libschedule-at-perl/t/t1.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libschedule-at-perl/t/t1.t?rev=25910&op=diff
==============================================================================
--- trunk/libschedule-at-perl/t/t1.t (original)
+++ trunk/libschedule-at-perl/t/t1.t Fri Oct 10 12:59:38 2008
@@ -1,12 +1,21 @@
use Test;
use strict;
-BEGIN { plan tests => 6 }
+BEGIN {
+ if ($< == 0 || $> == 0 || $ENV{'AT_CAN_EXEC'}) {
+ $main::FULL_TEST = 1;
+ plan tests => 8;
+ } else {
+ plan tests => 1;
+ }
+}
-my $verbose = 0;
+my $verbose = $ENV{'AT_VERBOSE'};
use Schedule::At;
ok(1);
+
+exit 0 unless $main::FULL_TEST;
my $rv;
@@ -44,7 +53,7 @@
);
$rv = Schedule::At::add (
TIME => $nextYear . '01181532',
- COMMAND => 'ls /cmd2/',
+ COMMAND => [ 'ls /testCMD2/', 'ls /testCMD3/' ],
TAG => '_TEST_tag2'
);
@@ -52,6 +61,11 @@
my %tag2Jobs = Schedule::At::getJobs(TAG => '_TEST_tag2');
listJobs('Schedule::At tag1 and tag2 added') if $verbose;
ok(join('', map { $_->{TAG} } values %tag1Jobs), '/^(_TEST_tag1)+$/');
+
+my ($jobid2, $content2) = Schedule::At::readJobs(TAG => '_TEST_tag2');
+ok($content2, '/testCMD2/');
+ok($content2, '/testCMD3/');
+
$rv = Schedule::At::remove (TAG => '_TEST_tag1');
$rv = Schedule::At::remove (TAG => '_TEST_tag2');
listJobs('Schedule::At tag1 and tag2 removed') if $verbose;
More information about the Pkg-perl-cvs-commits
mailing list