
mykolg
User
Jan 5, 2011, 5:49 PM
Post #20 of 24
(2981 views)
|
|
Re: [FishMonger] PERL cgi script
[In reply to]
|
Can't Post
|
|
Ok, well I added the apache to cygwin, just not sure where to put my script if so, also couldn't I just change my first line of code to it's location? Sorry, normally I use a putty program to login to my account at school. So I'm kinda learning the cygwin on my own. Any ideas? Below is what I changed my code to, trying to adjust for the certain day of the week since the paper isn't up till after 4pm my time and there is no paper on Saturdays. It didn't like my first bit where I tried to get the individual parts of the current time, though I did that part right, but I'm not sure what I'm doing wrong.
#!c:/cygwin/bin/perl.exe use warnings; use strict; use POSIX; use LWP::Simple; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my $today = strftime("%Y%m%d", localtime); my $yesterday = strftime("%Y(%m-01)%d", localtime); my $dayB4yesterday = strftime("%Y(%m-02)%d", localtime); system ('rm *.pdf'); if ($wday == 6){ for my $i ('01'..'10'){ getstore("http://state-journal.com/images/sj_media/$yesterday/pdf/A$i.pdf", "A$i.pdf"); getstore("http://state-journal.com/images/sj_media/$yesterday/pdf/B$i.pdf", "B$i.pdf"); } } elsif ($wday != 6){ if ($hour >= 16){ for my $i ('01'..'10'){ getstore("http://state-journal.com/images/sj_media/$today/pdf/A$i.pdf", "A$i.pdf"); getstore("http://state-journal.com/images/sj_media/$today/pdf/B$i.pdf", "B$i.pdf"); } } elsif ($hour < 16){ if ($wday == 7){ for my $i ('01'..'10'){ getstore("http://state-journal.com/images/sj_media/$dayB4yesterday/pdf/A$i.pdf", "A$i.pdf"); getstore("http://state-journal.com/images/sj_media/$dayB4yesterday/pdf/B$i.pdf", "B$i.pdf"); } } elsif ($wday != 7){ for my $i ('01'..'10'){ getstore("http://state-journal.com/images/sj_media/$yesterday/pdf/A$i.pdf", "A$i.pdf"); getstore("http://state-journal.com/images/sj_media/$yesterday/pdf/B$i.pdf", "B$i.pdf"); } } } } system ('pdftk *.pdf cat output Today.pdf'); system ('rm *.pdf'); print "Content-type: text/html\n\n"; print "<html>"; print "<head>"; print "<title>The State-Journal</title>"; print "</head>"; print "<body bgcolor=#000000>"; print "<font color=#FFFFFF>"; print "Testing"; print "</body>"; print "</html>";
(This post was edited by mykolg on Jan 5, 2011, 11:26 PM)
|