LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-22-2009, 03:44 PM   #1
xand49
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
Smile PERL: parsing html news entries into perl


Hello,

I'm currently writing a micro perl cms system to allow a company to update a news marquee, i'm currently taking form input and formatting the output into a html file.

What i'm wondering is how i can make it have 3 news entries where creating a new entry will erase the last one in the list.

I've not used perl for a few years and was amateur at best the last time i dabbled with it, i'll put my current code and a sample of the html entrys below.

the .pl
Code:
#!/usr/bin/perl
use CGI;
print "Content-type: text/html\n\n";
read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $FormData);
foreach $pair (@pairs) {
	($name, $value) = split(/=/, $pair);
	$value =~ tr/+/ /;
	$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
	$FORM{$name} = $value;}
print <<END_HTML;
<html><head> 
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body><marquee height="211" direction="up" scrollamount="1" scrolldelay="0" OnMouseOver="this.stop();" OnMouseOut="this.start();">
 <table border="0"><tr>
 <td width="1254" valign="top">
 <span class="date">$FORM{'dayte'}</span>
<br>
 <span class="title"><a href="news.html" target="_blank">$FORM{'title'}</a></span></td>
</tr><tr>
  <td><span class="ingress">$FORM{'content'}</span>    </td>
<tr>
 <td width="1254" valign="top">
</table></marquee></body></html>
END_HTML
a sample of the formatted html
Code:
 <td width="1254" valign="top">
<span class="date">2009-29-05</span>
<br>
<span class="title"><a href="news.html" target="_blank">Healthcare Sector Profile added</a></span></td>
</tr><tr>
  <td><span class="ingress">We are pleased to announce our new Healthcare sector profile PDF is now available online. Simply go to '<strong>Download latest brouchre</strong>' and click on the '<strong>Healthcare Secto</strong>r' button.</span>    </td>
any help with this matter would be much appreciated.

thanks for your time in advance!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl - Parsing HTML rjcrews Programming 3 08-09-2006 07:36 AM
Perl - Parsing HTML fails rjcrews Programming 5 06-15-2006 09:19 PM
perl files download instead of parsed on apache2 mod-perl2 not parsing perl files zeigerpuppy Debian 1 02-16-2006 05:31 AM
Parsing HTML using Perl smaida Programming 2 05-29-2004 01:20 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration