#!/usr/bin/perl -w use strict; use CGI qw(:standard); use Date::Calc qw(:all); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use HTML::AsSubs; use HTML::Element; use HTML::CalendarMonth; my $data="/path/data.txt"; my @Calendar = (); #my $checkthree = "1000"; my $checkthree = param ('check'); open (FILE,"$data") || die "whoops 1: $!"; my @all=<FILE>; close (FILE); foreach my $line (@all){ my ($one,$two,$three,$four,$five,$six,$seven,$eight) = split "\t", +$line; if ($three eq $checkthree) { @Calendar = split /\s+/,$seven; } } my @dates = sort @Calendar; print header(), start_html(-title => "Calendars"); while (defined $dates[0]) { my $days = $dates[0]; my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); @dates = CreateCal($year, $month, @dates); } print end_html(); exit(0); sub CreateCal { my ($cyear, $cmonth, @dates) = @_; my (@days, @temp); foreach my $days (@dates) { my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); if ($year == $cyear && $month == $cmonth) { push (@days, $day); } else { push (@temp, $days); } } my $c = new HTML::CalendarMonth( month => $cmonth, year => $cyear, ); $c->item($c->month)->wrap_content(font({size => '+2'})); $c->item($c->dayheaders)->wrap_content(font({size => '-1'})); $c->item(@days)->attr(bgcolor => '#CC0000'); print "<p>", $c->as_HTML, "</p>"; return @temp; }
(appreciation to Mr. Muskrat for the main part of the script)

My problem is that when I take a value via param( ) the result is a blank screen. If I comment out the param( ) line and use uncommentedmy $checkthree = "1000"; the script works fine.

Careful debugging led me to the use HTML::AsSubs; but I'm afraid I'm not knowledgable enough to get to the bottom of it.

I wonder if anyone could help me?

In reply to Problem with param( ) in Calendar script by jonnyfolk

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.