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!

#!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');
Here is the script that I suspect is in question.

In reply to HTML Template by raptorsoul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.