Hello,
I am probably doing something silly in this script but here it goes.
I am having a problem returning the day_of_week value when using a DATE::CALC module function. When I comment the function call out all the data prints but when I uncomment it just the header prints. I am able to print the $month $day $year variables within the print statement.
At any rate I am unable to obtain the "day of the week" for any given standard date.
Any suggestions
It is a short script but it is all there.The DB file is on the bottom.
Thanks
Tim
###################### CGI CODE BELOW #####################
#my $weekday = Day_of_Week($year, $month,$day);
#print "$month/$day/$year was a ", Day_of_Week_to_Text($weekday), "\n";
I am probably doing something silly in this script but here it goes.
I am having a problem returning the day_of_week value when using a DATE::CALC module function. When I comment the function call out all the data prints but when I uncomment it just the header prints. I am able to print the $month $day $year variables within the print statement.
At any rate I am unable to obtain the "day of the week" for any given standard date.
Any suggestions
It is a short script but it is all there.The DB file is on the bottom.
Thanks
Tim
###################### CGI CODE BELOW #####################
Code:
#!/usr/local/bin/perl -w
use strict;
use diagnostics;
use CGI qw(:standard);
use Date::Calc qw(Day_of_Week Week_Number Day_of_Year);
my $db ="data/events.txt";
open (FILE, "<" . $db) || die "Well, whats up.. cant open file";
#flock (FILE, 2 );
my $lc = 0;
print header();
print start_html(-title=>'Script');
print h2('Upcoming Parish Events!<a href="[URL unfurl="true"]http://www.martin.com/cgi-local/homepage_update/events/post_events.cgi">[/URL]
<BR>UPDATE UPCOMING PARISH EVENTS</a><BR><HR>');
while (<FILE>)
{
my $line = $_;
$line =~ s/\n$//;
my @events = split ("::", $line);
if ($events[1] eq ""){$lc = $line};
$lc ++;
my $year = $events[4];
my $month = $events[1];
my $day = $events[2];
#print "$month/$day/$year was a ", Day_of_Week_to_Text($weekday), "\n";
Code:
print" $month $day $year
<TABLE width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr align='left' valign='top' bgcolor='#669999'>
<td width='339' height='15' bgcolor='#cc99cc'>
<font size='2'>
<b>
<FONT face=arial color='#000000'>
</FONT><font color='#000000' face='Verdana, Arial, Helvetica, sans-serif' size='2'>
-
</font><FONT face=arial color='#000000'>
$events[1]
</FONT>
<font color='#000000' face='Verdana, Arial, Helvetica, sans-serif' size='2'>
</font><FONT face=arial color='#000000' size=2>
$events[2]
</FONT>
<font face='Verdana,Arial,Helvetica,sans-serif' color='#000000'>
$events[4]
</font>
</b>
</font>
</td>
</tr>
<tr align='left' valign='top' bgcolor='#669999'>
<td width='339' height='15' bgcolor='#FFFFFF'>
<FONT face='Arial narrow,Helvetica,Verdana,sans-serif'color='#000000'>
<B>
<FONT size=2>
$events[5]
</FONT>
</B>
</FONT>
<FONT face='Verdana, Arial, Helvetica, sans-serif' size=1>
$events[6]
</FONT>
</td>
</tr>
</TABLE>
";[/color]
[/color]
if ($events[1] eq ""){
#flock (FILE, 8 );
close (FILE);
}
print end_html();
}
###################### events.txt file ################
1054047381::Jun::14,::Sat::2003::ANNUAL DINNER DANCE<BR>presented by FIL_AM::The FIL-AM ASSOCIATION of St Martin invites you to our annual Independence Day dinner/dance celebration. Great food, entertainment, dancing and raffle tickets. $600 total cash & fabulous prizes.<BR>Please contact Moria Kang at 921-5912 for more info.
1050616643::Jun::18,::Wed::2003::SCRIPTURE SHARING<BR>::We invite you to share each Wednesday morning in prayer and reflection on the Scriptures. Sessions are 9:30am - 11:00am in the Cottrell Center. For more information<BR>email <a href="mailto:PatriceU7123@aol.com">Patrice Underwood</a> or call at 736-3725 ext:11</B>
1051234044::Jun::19,::Thu::2003::SENIOR TRIP <Font color ='red'>9:00AM - 4:00PM</font color>::<BR>We invite you to join a popular tour of five different churches:The Swedenborgian Church, a lovely country-styled church;The Buddhist Church, with its stunning altar; The Greek Orthodox Cathedral of the Annunciation where the group will have lunch; The Old First Presbyterian Church, now the oldest Protestant Church in California; and St. Peter and Paul’s National Italian Church that is awesome. Cost: tour, bus fare, and lunch - $42.00 per person. Call Jackie at the Parish Office, 736-3725 or stop by during office hours.
1051234038::Oct::10,::Sat::2003::St. Martin International Festival::<BR>On Saturday, October 10, you are invited to share in the annual St. Martin Parish International Festival.
1051234039::Oct::11,::Sun::2004::St. Martin International Festival::<BR>On Sunday, October 11, you are invited to share in the annual St. Martin Parish International Festival.