I am writing a rss file. Here is the full code:
######################### # includes ######################### use strict; use warnings; use CGI qw(:standard); use XML::RSS; ######################### # vars ######################### my $dateStamp; my $dirPath = "C:/Inetpub/wwwroot/mywebsite/rss/"; my $newName = ''; my $passName = ''; my $currentDate; my $fullOutfile; ######################### # make a date stamp ######################### my ($sec, $min, $hour, $mday, $mon, $year) = localtime; $mon += 1; #this will change the month from a 0-11 format to a +useable 1-12 format $year += 1900; # year is number since 1900 - so we add 1900 to +get the full year. $dateStamp = "$year$mon$mday$hour$min"; # datestamp to identify + the entry ######################### # sub to get rss input from htm form and write it to a file ######################### sub getInput { my $title = param('title'); my $desc = param('desc'); my $full = param('full'); my $template = $dirPath. "rss_outtemplate.htm"; my $tempHTML =''; my $fullOutfile = "$dirPath.rss.htm"; $full =~ s/\r/<br><br>/g; # putting <br>'s in where there were cr' +s in the input ######################### # format the form data using a template ######################### open(FILEFULL, $template) or die ("Couldn't open template file - $ +template - $!\n"); while (<FILEFULL>) { s/xTitle/$title/g; s/xDesc/$desc/g; s/xfull/$full/g; $tempHTML .= $_; } close FILEFULL or die ("Couldn't close $template - $!\n"); ######################### # write the form data with template to the dump file ######################### open(FILESTOR,"> $fullOutfile") or die ("Couldn't open $fullOutfil +e - $!\n"); print FILESTOR $tempHTML; close FILESTOR or die ("Couldn't close $fullOutfile - $!\n"); return $fullOutfile } ######################### # rename the dump file with fileTag ######################### sub renameFile ($$){ my $fileTag = shift; my $fullOutfile = "$dirPath.rss.htm"; $passName = $fileTag. "rss.htm"; my $newName = $dirPath.$fileTag. "rss.htm"; rename $fullOutfile, $newName or die ("Couldn't rename rss out fil +e - $fullOutfile - $!\n"); return $passName; } ######################### # sub to write the rss file ######################### sub writeRss ($) { my $rss = new XML::RSS (version => '1.0'); my $rss_output = "$dirPath/rss.xml"; my $title = param('title'); my $desc = param('desc'); my $rss_link = shift; $rss_link = "http://www.mywebsite.com/rss/$rss_link"; $rss->parsefile($rss_output); pop(@{$rss->{'items'}}) if (@{$rss->{'items'}} == 15); $rss->add_item(title => $title, link => $rss_link, description => $desc, mode => 'insert' ); $rss->save($rss_output); } ######################### # wrap it all up ######################### sub writeAfter { print "Content-type: text/html\n\n"; print "Sucess - put something in here later ... a page to link bac +k to the site - stuff like that.\n" } ######################### # call subs ######################### getInput; renameFile ($dateStamp, $fullOutfile); writeRss ($passName); writeAfter; undef &main;

In reply to Re: Re: Re: Re: XML::RSS question by Anonymous Monk
in thread XML::RSS question by Anonymous Monk

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.