bikeNomad -- Good question.
I should probably apologize for the original question to
begin with. It arose from a problem I recently encountered
with a
program
that I borrowed and extensively rewrote. It has worked
fine with few problems since 6/98 but recently stopped
displaying daily and weekly links from the six-month
calendar view. I did recently upgrade to Perl 5.6.1 (before
anything broke) but am reluctant to jump to conclusions.
I thought that I had brought home my Programming Perl
book for the weekend but accidently grabbed Essential
System Administration instead. Had I grabbed the right book
I wouldn't have needed to ask the question at all.
I narrowed down the problem to the (-s _) clause in
question and felt that posting the larger snippet might
raise a lot of questions rather than answer a simple one:
foreach $day (@dow) {
$TestDate = "$year$cur_month$link_num[$day]";
if ($Event_Hash{$TestDate} && (-s _)) {
### URL to display events for a single day.
$cal_html = "$EVENT_SUM_URL?Qtype=day&";
$cal_html .= "BegDate=$year$cur_month$link_num[$day]\">";
s|^$day |$cal_html${day}${end_anchor} |;
s| $day$| $cal_html${day}${end_anchor}|;
s| $day | $cal_html${day}${end_anchor} |;
$cal_html = "$CAL_LIST_URL_AUTH?date=$date\">";
}
}
if (/</) {
### URL to display events for the current week
$Wk_HTML = "$EVENT_SUM_URL?Qtype=week&" .
"BegDate=$year$cur_month$link_num[$First_DOW]&" .
"EndDate=$year$cur_month$link_num[$Last_DOW]&" .
"WeekNo=$CurrentWk\">";
$output_pub[$current_line] .= "$_ $Wk_HTML" . "w$end_anchor ";
} else {
$output_pub[$current_line] .= "$_ ";
}
I doubt that I wrote the (-s _) clause since I normally try
to avoid cryptic code whenever possible. In any case it is
unnecessary to perform a -s at this point since all the
data read from files is already stored in hashes. The
biggest mysteries are how I overlooked it to begin with and
why did it work for three years without any noticed
problems.
The line in question has been reduced to:
if ($Event_Hash{$TestDate}) {
instead of:
if ($Event_Hash{$TestDate} && (-s _)) {
Thanks to all for responding.
|