FAQ
How do you create your websites' RSS feeds?

I run a script called createrss.pl as a cron job every hour which checks
if there are any new stories and if so creates a new feed.rss file

I think this method takes up a lot of RAM and CPU power since it
launches Perl every hour, but I can't think of anything better.

The other way I thought of (and rejected) was to have the web script
that accepts a new story from the administrator, to also create the RSS
file. But I rejected this because if two people might submit a story at
the same time then the resulting RSS file might only contain one of them.

So, how do you do it?

- Kar

Search Discussions

  • Tom Phoenix at Oct 11, 2006 at 6:43 pm

    On 10/11/06, Karjala wrote:

    I run a script called createrss.pl as a cron job every hour which checks
    if there are any new stories and if so creates a new feed.rss file

    I think this method takes up a lot of RAM and CPU power since it
    launches Perl every hour, but I can't think of anything better.
    A moderately-powerful machine should be capable of tens of thousands
    of launches per hour; one more won't be noticeable. Of course, if your
    program takes more than 58 minutes to run, maybe there's room for
    improvement. :-)
    The other way I thought of (and rejected) was to have the web script
    that accepts a new story from the administrator, to also create the RSS
    file. But I rejected this because if two people might submit a story at
    the same time then the resulting RSS file might only contain one of them.
    That sounds like a job for flock(). By locking the file, your process
    "installs a traffic light", so to speak. If everybody uses flock()
    properly, each process will wait for a green light before editing the
    file.

    Hope this helps!

    --Tom Phoenix
    Stonehenge Perl Training

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedOct 11, '06 at 2:13p
activeOct 11, '06 at 6:43p
posts2
users2
websiteperl.org

2 users in discussion

Karjala: 1 post Tom Phoenix: 1 post

People

Translate

site design / logo © 2022 Grokbase