Eagle_f91 has asked for the wisdom of the Perl Monks concerning the following question:
#!/user/bin/perl -w use strict; use CGI q~:standard~; my ($BasePath, $i, @NewsBoard, @NewsFile, $NewsPost, @News, $ID, @Mont +h, $Sec, $Min, $Hour, $MDay, $Mon, $Year, $WDay, $YDay, $IsDST, $Time +); @Month = ('January', 'February', 'March', 'April', 'May', 'June', 'Jul +y', 'August', 'September', 'October', 'November', 'December'); $BasePath = 'D:/finalfantasyinfo/community'; open (FILE, "$BasePath/boards/news.txt") or die 'Can not open new boar +d file'; @NewsBoard = <FILE>; close FILE; @NewsBoard = sort { $b <=> $a } @NewsBoard; $i = 0; while ($i < 4) { @NewsFile = split (/\|/, "$NewsBoard[$i]"); open (FILE, "$BasePath/messages/$NewsFile[0].txt") or die 'Can not + open News File'; $NewsPost = <FILE>; close FILE; @News = split (/\|/, "$NewsPost"); &ProcessHTML(); $i++; } sub ProcessHTML { $ID = $News[3]; ($Sec, $Min, $Hour, $MDay, $Mon, $Year, $WDay, $YDay, $IsDST) = lo +caltime($News[3]); if ($Min < 10) { $Min = qq~0$Min~; } if ($Hour > 12) { $Hour = $Hour -12; $Hour = qq~$Hour:$Min P.M.~; } else { $Hour = qq~$Hour:$Min A.M.~; } $Year = 1900 + $Year; $Time = qq~$Hour on $Month[$Mon] $MDay, $Year~; $News[8] =~ s/\[(\/)?(b|u|i)\]/<$1$2>/gi; $News[8] =~ s~\[center](.*?)\[/center]~<center>$1</center>~gi; $News[8] =~ s~\[url=(\S+?)\](.*?)\[/url\]~<a href="$1">$2</a>~gi; $News[8] =~ s~\[img](.*?)\[/img\]~<img src="$1" alt="" />~gi; $News[8] =~ s~\s*\[\*\]~</li><li>~isg; $News[8] =~ s~\[olist\]~<ol>~isg; $News[8] =~ s~\s*\[/olist\]~</li></ol>~isg; $News[8] =~ s~</li><ol>~<ol>~isg; $News[8] =~ s~<ol></li>~<ol>~isg; $News[8] =~ s~\[list\]~<ul>~isg; $News[8] =~ s~\s*\[/list\]~</li></ul>~isg; $News[8] =~ s~</li><ul>~<ul>~isg; $News[8] =~ s~<ul></li>~<ul>~isg; $News[8] =~ s~\[ch9679\]~●\;~isg; print qq~<p class="center"><span class="header">$News[0]</span> <br />Posted by: $News[1] at $Time</p> <p>$News[8]</p> <p style="text-align: right"><a href="http://www.ffinfo.com/community/ +YaBB.pl?num=$ID">Discuss this posting.</a></p>~; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Scripts work under perl .exe but not ISAPI
by Anonymous Monk on Oct 23, 2009 at 19:26 UTC | |
by Eagle_f91 (Acolyte) on Oct 24, 2009 at 01:58 UTC | |
by tye (Sage) on Oct 24, 2009 at 12:03 UTC | |
by Anonymous Monk on Oct 25, 2009 at 03:21 UTC | |
by Anonymous Monk on Oct 24, 2009 at 07:10 UTC | |
by Anonymous Monk on Oct 24, 2009 at 07:47 UTC |