CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Homepage

 



TappedOut87
New User

Sep 9, 2013, 8:48 AM

Post #1 of 5 (539 views)
Homepage Can't Post

new to Perl,

on my work homepage, the announcements will not change directly on the website. The perl programming is saved on notepad, I could change the announcements there, but not on the site. any help please.


Laurent_R
Enthusiast / Moderator

Sep 9, 2013, 10:03 AM

Post #2 of 5 (534 views)
Re: [TappedOut87] Homepage [In reply to] Can't Post

You are giving far too few details.

The best would be that you provide a sample of your code explaining which part is not doing what you expect.


TappedOut87
New User

Sep 9, 2013, 1:31 PM

Post #3 of 5 (529 views)
Re: [Laurent_R] Homepage [In reply to] Can't Post

well here is some of the code.
div id="announcements">
<h3><span>Announcements</span></h3>
<div id="announcementsList">
Date: <input type="text" name="date" value="$anns{'date'}" size="25" /><br />
<input type="text" name="ann1" value="$anns{'ann1'}" size="70" /><br />
<input type="text" name="ann2" value="$anns{'ann2'}" size="70" /><br />
<input type="text" name="ann3" value="$anns{'ann3'}" size="70" /><br />
<input type="text" name="ann4" value="$anns{'ann4'}" size="70" /><br />
<input type="text" name="ann5" value="$anns{'ann5'}" size="70" /><br />
<input type="submit" name="Announce" value="Submit Announcements" />
</div>
</div>


TappedOut87
New User

Sep 9, 2013, 1:36 PM

Post #4 of 5 (528 views)
Re: [TappedOut87] Homepage [In reply to] Can't Post

here is some more. this one is off man_home.pl

if($read) {

if($pass eq $password) {

%anns;
open HOME, "< index.html";
while(<HOME>) {
if(/name="ann(\d)">(.*?)<\/li>/) {
if($1 == "1") { $anns{"ann1"} = $2; }
elsif($1 == "2") { $anns{"ann2"} = $2; }
elsif($1 == "3") { $anns{"ann3"} = $2; }
elsif($1 == "4") { $anns{"ann4"} = $2; }
elsif($1 == "5") { $anns{"ann5"} = $2; }
}
elsif(/id="date">(.*?)</) {
$anns{"date"} = $1;
}
}
close HOME;


Laurent_R
Enthusiast / Moderator

Sep 10, 2013, 8:46 AM

Post #5 of 5 (509 views)
Re: [TappedOut87] Homepage [In reply to] Can't Post

 


Code
if(/name="ann(\d)">(.*?)<\/li>/) {


This probably does not work because you don't have a ">" right after "ann1', "ann2", etc.


Code
if($1 == "1") { $anns{"ann1"} = $2; }


Either do a numeric comparison:


Code
if($1 == 1) { $anns{"ann1"} = $2; }


or do a string comparison:


Code
if($1 eq "1") { $anns{"ann1"} = $2; }


mixing the two might give you some trouble.

This holds also for the other comparisons.

BTW, if you had used strictures, you would have had a warning about this. Always put "use strict;" and "use warnings;" at the top of your programs.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives