Please support our Perl advertiser: Programming Forums
![]() |
•
•
Join Date: Jan 2006
Posts: 28
Reputation:
Rep Power: 3
Solved Threads: 0
Hi,
Someone put together a small perl script for me that uses day and time to determine which of two images to display (open.gif or closed.gif). I need to modify the script to also include a hyperlink to open.html or closed.html so that if the open image is displayed it uses the open.html link and the closed to closed.html. The corresponding web page that loads the image is ultra basic, with a link to the .pl script as the image tag.
Can anyone help a real perl novice (me!) with this one?
Thanks guys!
Someone put together a small perl script for me that uses day and time to determine which of two images to display (open.gif or closed.gif). I need to modify the script to also include a hyperlink to open.html or closed.html so that if the open image is displayed it uses the open.html link and the closed to closed.html. The corresponding web page that loads the image is ultra basic, with a link to the .pl script as the image tag.
Can anyone help a real perl novice (me!) with this one?
Thanks guys!
perl Syntax (Toggle Plain Text)
#!/usr/bin/perl use CGI::Carp qw/fatalsToBrowser/; use strict; use warnings; # path to folder where images are # assumes an image named open.gif and closed.gif my $path = '/home/fireplug/public_html/images/'; # time in military format 0-23 # first number is opening time # second number is closing time # 24-24 indicates always closed # server is central standard time so time is adjusted minus 1 hour my %schedule = ( Sun => [9,11], Mon => [10,11], Tue => [10,11], Wed => [10,11], Thu => [10,11], Fri => [10,11], Sat => [24,24] ); # default value my $image = 'closed.gif'; # get the day and hour my ($day, $hour) = (split(/ /,scalar localtime))[0,3]; $hour = (split(/:/,$hour))[0]; # check the day and hour if ($schedule{$day}[0] <= $hour && $schedule{$day}[1] > $hour) { $image = 'open.gif'; } #print appropriate MIME type header print "Content-type: image/gif\n\n"; open(FH,"$path$image") or die "$!"; binmode(FH); print while (<FH>); close(FH); exit;
![]() |
Similar Threads
Other Threads in the Perl Forum
- How to call a perl script in the C# app? (C#)
- I get the error no file or directory when i try to run a perl script (Perl)
- perl script help re: scope/structure for noob (Perl)
- How to supress warning meesge when i run an command from perl script (Existing Scripts)
- On execution of perl script, popup asks if i want to save or run this file (Linux Servers and Apache)
- Calculate the amount of time in the linux process using perl script (Perl)
Other Threads in the Perl Forum
- Previous Thread: cgi to javascript
- Next Thread: plz explain me wht does this script means.It is a perl script.
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode