NAME
Tk::Schedule - Perl extension for a graphical user interface to carrying out tasks up to schedule
SYNOPSIS
my $schedule = $parent->Schedule(options);
EXAMPLE
use Tk;
use Tk::Schedule;
my $mw = MainWindow->new();
my $s = $mw->Schedule(
-interval => 30,
-repeat => "once",
-command => sub { print("Hello World\n") for(1..10); },
-comment => "check Mail-Box"
)->pack();
MainLoop();
SUPER-CLASS
Schedule is derived from the Frame class. This megawidget is comprised of an ChooseDate TimePick Entry Listbox Button Radiobutton allowing to create a schedule.
DESCRIPTION
With this Widget function at a certain time can be called. A schedule can be made for longer periods. The call of functions can be repeated in certain course of time. Possible repetition times are: hourly daily weekly monthly yearly For seconds or minutes the functions $widget->after(time, call) or $widget->repeat(time, call) can be better used.
CONSTRUCTOR AND INITIALIZATION
my $s = $mw->Schedule(
-interval => 30, # default 10
-repeat => "daily", # default once
-comment => "send E-Mail to mail@addresse.com",
-command => sub { print("Hello World\n") for(1..10); },
# -command => [\&DownloadWebsite, $server, $agrs],
# -command => \&ShowPicture,
-scheduletime => time()
)->pack();
WIDGET SPECIFIC OPTINOS
All options not specified below are delegated to the Listbox widget.
- -interval
-
After how much seconds the program checks the schedule. default = 10
- -command
-
A reference to a function or array. The first element of the array must be a reference to a function.
- -repeat
-
In which periods the call of the function is repeated. Possible repetition times are: "hourly", "daily", "weekly", "monthly", "yearly" default "once" that does mean NO repetition
- -comment
-
This comment is indicated in the list box.
- -scheduletime
-
Time in seconds to indicate. default return value of time();
INSERTED WIDGETS
- ChooseDate
-
Popup Calendar with support for dates prior to 1970. Author Jack Dunnigan
- TimePick
-
A graphical user interface to pick timestrings syntax mistake-secure. Author Torsten Knorr
- Button
- Listbox
- Entry
ADVERTISED WIDGETS
The following widgets are advertised:
- ScheduleFrame
- ScheduleEntryComment
- ScheduleChooseDate
- ScheduleTimePick
- ScheduleRadioOnce
- ScheduleRadioYearly
- ScheduleRadioMonthly
- ScheduleRadioWeekly
- ScheduleRadioDaily
- ScheduleRadioHourly
- ScheduleListbox
- ScheduleButtonDelete
- ScheduleButtonAdd
METHODS
The following functions should be used like private functions.
- CheckForTime
- ReworkSchedule
- AddTime
- ShowSchedule
- DeleteTime
-
The following functions should be used like public functions.
- insert
-
With this method you can add a task from the program. As parameter you can use the options -repeat, -command, -comment or -scheduletime in every combination. $widget->insert(); $widget->insert(-repeat => "once"); $widget->insert(-command => sub { }); $widget->insert(-comment => "new task"); $widget->insert(-scheduletime => time()); $widget->insert( -repeat => "hourly", -command => sub { print("every hour\n"); }, -comment => "every hour", -scheduletime => time() );
- scheduletime
-
Set the time to indicate. $widget->scheduletime(time_in_seconds); or $widget->configure( -scheduletime => time() );
WIDGET METHODS
Call configure to use the following functions. $schedule->configure( -interval => 20, -command => \&DailyDuty, -repeat => "daily", -comment => "every day the same task", -scheduletime => time(), );
- interval
- command
- repeat
- comment
- scheduletime
PREREQUISITES
- Tk
- Tk::Frame
- Tk::Photo
- Tk::TimePick
- Tk::ChooseDate
- Date::Calc
- Bit::Vector
- Carp::Clan
- Time::Local
- Storable
- B::Deparse
EXPORT
None by default.
SEE ALSO
Tk::TimePick Tk::ChooseDate
BUGS
Maybe you'll find some. Please let me know.
AUTHOR
Torsten Knorr, <torsten@mshome.net>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Torsten Knorr torstenknorr@tiscali.de http://www.planet-interkom.de/t.knorr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.2 or, at your option, any later version of Perl 5 you may have available.
12 POD Errors
The following errors were encountered while parsing the POD:
- Around line 478:
'=item' outside of any '=over'
- Around line 504:
You forgot a '=back' before '=head1'
- Around line 506:
'=item' outside of any '=over'
- Around line 524:
You forgot a '=back' before '=head1'
- Around line 528:
'=item' outside of any '=over'
- Around line 554:
You forgot a '=back' before '=head1'
- Around line 558:
'=item' outside of any '=over'
- Around line 596:
You forgot a '=back' before '=head1'
- Around line 607:
'=item' outside of any '=over'
- Around line 617:
You forgot a '=back' before '=head1'
- Around line 619:
'=item' outside of any '=over'
- Around line 641:
You forgot a '=back' before '=head2'