in reply to Which feed method?

WAT? File read and process is probably always going to be less intensive than HTTP request. You have to parse the RSS for both. Don’t read the file repeatedly all the time; either respect the TTL from the feed or stat the file to see if it’s fresh. The HTTP requires, depending on webserver technique, a server side file read too so there are additional clock costs hidden there. How you parse the RSS is going to matter too. I am a bit out of the loop but I would assume that XML::RSS::LibXML would be the most performant choice. You know what they say about assumptions and performance. :P

Replies are listed 'Best First'.
Re^2: Which feed method?
by hankcoder (Scribe) on May 08, 2016 at 05:48 UTC

    Thank you man. I'm not very good in technical details. However I have learn something new from your suggestions. I didn't know I can check file stat of modified age.

    Could you correct me if I'm wrong, is it using -M $filename > n days ? -M (Modification age)

      Yeppers. -X: -M Script start time minus file modification time, in days. See also stat.

      Actually, as YourMother pointed out, -M is script start time minus file modification time, in days. So, you will get different results every time your script is started.

      Using stat, however, will give you the actual modification time in seconds since the epoch.1 You will always get the most recent time the file was modified no matter when your script was started.


      1If you don't know what the epoch is, don't worry, it's just a fixed point in time defined in a standard.

        Thanks RonW, -M actually serve my purpose if I only going to get modification time in days.

        The stat yes will give actual modification time in seconds. I have tested it out. However, on my script start/execution, I still need get current time() and make compare to file modification time so I can get "x time ago". Perhaps I misunderstand of stat where there are better way to achieve my goal.

        Sorry, little off topic. This should be about feed. -M were useful to me as well.