FMLの最新の投稿を表示(RSSのダウンロードと表示)
30分プログラム、その779。英語のお勉強になる気がしたので、FML : Your everyday life storiesの最新の投稿を表示するプログラムを書いてみました。
RSSをダウンロードして本文部分を表示してるだけです。
使い方
$ perl fml.pl Today, I broke my nose opening a jar of jelly. FML ------------------------------ Today, I tried to explain to my boyfriend that waffles and pancakes are basically the same thing, just different shapes. I'm now single. FML ------------------------------ Today, I found out that while getting your hair cut, you should say 'yes' or 'no', instead of nodding your head. FML ------------------------------ Today, my future husband said to me "I want to be all over you like maggots on a dead guy." He was serious. FML ------------------------------ Today, I got into my car, turned it over, and the engine started banging really bad. Yesterday, I got an oil change at the Supercenter. They forgot to put the oil back in and now I have a rod blown down through my oil pan and a dead engine. FML ------------------------------ ....
ソースコード
#! /usr/bin/perl # -*- mode:perl; coding:utf-8 -*- use strict; use warnings; use Data::Dumper; use XML::FeedPP; my $source = 'http://feeds2.feedburner.com/fmylife'; my $feed = XML::FeedPP->new( $source ); foreach my $item ( $feed->get_item() ) { my $desc = $item ->description(); $desc =~ s!<img.*/>!!g; print $desc, "\n"; print "------------------------------\n"; }