(appreciation to Mr. Muskrat for the main part of the script)#!/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; }
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |