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.

In reply to Re: Re: Conditional Wierdness by jlongino
in thread Conditional Wierdness by jlongino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.