I am using the following code to display open/closed sign during office hours using the server time, I need to be able to say if its Saturday or Sunday display closed.
Any help would really be appreaciated
THE CODE:
#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
# get current time
my($min,$hour,$day,$Week_Day,$mon) = (localtime)[1...5];
my $time = sprintf("%02d%02d", $hour, $min);
$mon++;
# get open/closed sign
my $sign_file;
if (900 <= $time && $time <= 1800) { $sign_file = "mast_opensign_open.gif"; }
else { $sign_file = "mast_opensign_closed.gif"; }
# set as closed for holidays
if ($mon == 12 && $day == 25) { $sign_file = "mast_opensign_closed.gif"; }
if ($mon == 12 && $day == 26) { $sign_file = "mast_opensign_closed.gif"; }
if ($mon == 1 && $day == 1) { $sign_file = "mast_opensign_closed.gif"; }
# load sign
my $data;
open(FILE,"<$Bin/$sign_file") ¦¦ die $!;
binmode(FILE);
read(FILE,$data, -s FILE);
close(FILE);
# output image
binmode(STDOUT);
print "Content-type: image/gif\n";
print "Cache-Control: no-cache\n";
print "Pragma: no-cache\n";
print "Expires: -1\n";
print "\n";
print $data;
exit;
Kind Regards
Walker