summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-01-02 16:08:06 +0000
committerfukachan <fukachan>2004-01-02 16:08:06 +0000
commite0a6e270dbc038b9455f6cf9910e89dc3c41ba62 (patch)
tree5e58776460fc7194c5d4352bebbb7399438d0f5d
parent616f369d353e5a238348bc14e4b342d597d12508 (diff)
downloadfml8-e0a6e270dbc038b9455f6cf9910e89dc3c41ba62.tar.gz
fml8-e0a6e270dbc038b9455f6cf9910e89dc3c41ba62.tar.bz2
fml8-e0a6e270dbc038b9455f6cf9910e89dc3c41ba62.zip
more error checks.
fix comments.
-rw-r--r--fml/lib/FML/Process/Calendar.pm31
1 files changed, 27 insertions, 4 deletions
diff --git a/fml/lib/FML/Process/Calendar.pm b/fml/lib/FML/Process/Calendar.pm
index 17838d8f..20cd15bf 100644
--- a/fml/lib/FML/Process/Calendar.pm
+++ b/fml/lib/FML/Process/Calendar.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002,2003,2004 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Calendar.pm,v 1.8 2004/01/02 02:11:26 fukachan Exp $
+# $FML: Calendar.pm,v 1.9 2004/01/02 14:50:33 fukachan Exp $
#
package FML::Process::Calendar;
@@ -39,12 +39,24 @@ standard constructor.
=head2 prepare($args)
-dummy.
+load default configuration file to use path_* variables.
=head2 verify_request($args)
dummy.
+=head2 run($args)
+
+main routine.
+
+parse files under ~$user/.schedule/ directory and summarize it.
+
+Lastly, use w3m to show schedul as html table.
+
+=head2 finish($args)
+
+dummy.
+
=cut
@@ -127,10 +139,16 @@ sub run
my $tmpf = $schedule->tmpfilepath;
my $wh = new FileHandle $tmpf, "w";
+ unless (defined $wh) {
+ my $s = "cannot open temporary file";
+ $curproc->logerror($s);
+ croak($s);
+ }
+
# set output mode
$schedule->set_mode( $mode );
- # -a option: show three calendar for this, next and last month.
+ # -a option: show three calendars for this, next and last month.
if (defined($option->{ a })) {
for my $month ('this', 'next', 'last') {
$schedule->print_specific_month($wh, $month);
@@ -151,7 +169,12 @@ sub run
if ($mode eq 'text') {
my $w3m = $config->{ path_w3m } || 'w3m';
- system "$w3m -dump $tmpf";
+ if (-x $w3m) {
+ system "$w3m -dump $tmpf";
+ }
+ else {
+ $curproc->logerror("w3m not found");
+ }
}
else {
$curproc->cat( [ $tmpf ] );