raptorsoul has asked for the wisdom of the Perl Monks concerning the following question:
Okay, here's my quandary. Our church website was written by someone who has now moved away. I have taken over the site, but know very little about perl. The site ran fine until recently when I updated the server from XP to Windows 7. Now running the original perlscript gives a 502 error.
The perlscript in question was designed to search the contents of a specified folder and find all of the .wmv files (recorded sermons). It then creates an HTML form from a template, providing links to these files. It also listed the date and speaker for each file, which is determined by the filename.
I have tried very simple scripts and they have all worked fine, but the original script does not. I think that the problem may reside in the upgrade from 32 bit to 64 bit, or possibly the upgrade in ActivePearl.
Here is the code where I suspect the problem lies. Please keep in mind, I didn't write this! LOL!
Here is the script that I suspect is in question.#!d:/perl/bin/perl -w ######!/usr/bin/perl -w $yeardir=$ENV{'QUERY_STRING'}; use HTMLTMPL; # Create the template object and load it. $templ = new HTMLTMPL; $templ->src('d:/wwwroot/calvarybaptist/cgi-bin/sermon/sermons.html'); #get the list of audio files from the sermons directory #for this to work correctly the files should be names xxxxxxsP.ram # replace the xxxxxx with the date ie 100399 # replace the P with G for Pastor Gerhardt or V for Guest Speaker # replace the s with M for morning sermon, e for evening sermon or w f +or midweek # ex 100399MG would be the sermon for October 3, 1999 Morning's Sermon + by Pastor Gerhardt # if there is a technical problem with the sermon add a t or T to the +end ie # ex 100399MGt #opendir(DIR, "/webpages/calvarybaptist/sermons/"); #opendir(DIR, "/home/rmserver/Content/"); #opendir(DIR, "d:/Sermons/"); opendir(DIR, "d:/wwwroot/CalvaryBaptist/Sermons/".$yeardir); @ramFiles = sort(grep(/\.wmv$/,readdir(DIR))); #@ramFiles = sort(grep(/\.rm$/,readdir(DIR))); #@ramFiles = sort(grep(/\.ram$/,readdir(DIR))); #@ramFiles = sort(grep(/\.HTML$/,readdir(DIR))); closedir(DIR); foreach $i (@ramFiles) { #MMDDYYSD #MM = Month 0-1 (2) #DD = Day 2-3 (2) #YY = Year 4-5 (2) #S = Sermon (1) # M = Morning # e = Evening # w = Wednesday # s = Sunday School # x = Special #D = Who delivered # G = Gerhardt # H = Halverson # B = Brown # V = Guest # N = None $month=substr($i,0,2); $day=substr($i,2,2); $year=substr($i,4,2); if ((substr($i,6,1) eq "m") or (substr($i,6,1) eq "M")){ $whichsermon="Morning Sermon"; } elsif ((substr($i,6,1) eq "e") or (substr($i,6,1) eq "E")){ $whichsermon="Evening Sermon"; } elsif ((substr($i,6,1) eq "w") or (substr($i,6,1) eq "W")){ $whichsermon="Midweek Sermon"; } elsif ((substr($i,6,1) eq "s") or (substr($i,6,1) eq "S")){ $whichsermon="Sunday School"; } elsif ((substr($i,6,1) eq "x") or (substr($i,6,1) eq "X")){ $whichsermon="Special"; } else { $whichsermon="ERROR Determing Sermon."; } # Determin who delivered the sermon #if ((substr($i,7,1) eq "g") or (substr($i,7,1) eq "G")){ # $speaker="Pastor Gerhardt"; #} #elsif ((substr($i,7,1) eq "b") or (substr($i,7,1) eq "B")){ # $speaker="Asst. Pastor Brown"; #} #elsif ((substr($i,7,1) eq "h") or (substr($i,7,1) eq "H")){ # $speaker="Pastor Halverson"; #} #elsif ((substr($i,7,1) eq "v") or (substr($i,7,1) eq "V")){ # $speaker="Guest Speaker"; #} #elsif ((substr($i,7,1) eq "n") or (substr($i,7,1) eq "N")){ # $speaker=""; #} #else { # $speaker="ERROR code for speaker is incorrect." #} #Check to see of there was a technical problem with the sermon. # if ((substr($i,8,1) eq "T") or (substr($i,8,1) eq "t")){ # $speaker="Technical Problems"; # } $desc=substr($i,8,length($i)-12); #.' '.(length($i)).' '.$i.'!'; $filename=$yeardir."/".$i; $test=$month.'/'.$day.'/'.$year.' '.$whichsermon.', '.$desc.' '; # $templ->filename("$i", 'x_details'); $templ->filename("$filename", 'x_details'); $templ->desc("$test", 'x_details'); } # Send the completed html document to the web server. $templ->output('Content-Type: text/html');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML Template
by MidLifeXis (Monsignor) on May 07, 2015 at 12:40 UTC | |
by raptorsoul (Novice) on May 10, 2015 at 05:36 UTC | |
by afoken (Chancellor) on May 10, 2015 at 09:38 UTC | |
|
Re: HTML Template
by thomas895 (Deacon) on May 07, 2015 at 01:36 UTC | |
by raptorsoul (Novice) on May 10, 2015 at 05:48 UTC | |
by raptorsoul (Novice) on May 10, 2015 at 15:47 UTC | |
by thomas895 (Deacon) on May 11, 2015 at 01:27 UTC | |
by Anonymous Monk on May 10, 2015 at 23:09 UTC | |
by raptorsoul (Novice) on Jul 21, 2015 at 22:55 UTC | |
by raptorsoul (Novice) on Jul 21, 2015 at 22:51 UTC | |
|
Re: HTMLTMPL.pm
by Anonymous Monk on May 07, 2015 at 00:57 UTC | |
by raptorsoul (Novice) on May 10, 2015 at 05:46 UTC | |
by Anonymous Monk on May 10, 2015 at 07:50 UTC | |
by raptorsoul (Novice) on May 10, 2015 at 15:43 UTC | |
|
Re: HTML Template
by soonix (Chancellor) on May 11, 2015 at 08:42 UTC | |
by Anonymous Monk on May 11, 2015 at 08:49 UTC | |
by soonix (Chancellor) on May 11, 2015 at 09:42 UTC |