Den här koden kom till utav frustration när jag läste nyheter från idg.se. Det är inte ovanligt att det är mer rekalm än innehåll när en nyhet presenteras, villket jag inte har något emot, men dom där flashanimeringarna som aldrig slutar roterar och blippar i alla illskna färger... usch, respektlöst!
Med den här modulen blir det enkelt att presentera informationen på ett sätt som tilltalar en själv.
Varför inte generera en "full" rss feed som du kan läsa med din favorit aggregator eller kanske en egen nyhetsagent?
SYNOPSIS
use IDG;
# todays articles from all magazines
my $serach = IDG::Serach->new();
# articles from 2003-10-01 and all magazines
my $serach = IDG::Serach->new(
month => 10,
day => 1
);
# this weeks articles from all magazines
my $serach = IDG::Serach->new(
type => "week"
);
# this month articles from all magazines
my $serach = IDG::Serach->new(
type => "month"
);
# todays articles from CS (Coputer Sweden)
my $serach = IDG::Serach->new(
magazine => 'CS'
);
# articles from week 45 this year and from CS
my $serach = IDG::Serach->new(
type => "week",
week => 45,
magazine => 'CS'
);
# game articles from this week
my $serach = IDG::Serach->new(
type => "week",
category => 7
);
my @articles = $serach->articles; # returns IDG::Article objects
for my $article ( @articles ) {
my $id = $article->id; # IDG article id
my $date = $article->date; # 2003-11-06
my $time = $article->time; # 12:10:00
my $datetime = $article->datetime; # DateTime object
my $title = $article->title; #
my $description = $article->description; # Preamble of article
my $content = $article->content; # Entire content of article
my $link = $article->link; # URL to article
my $image = $article->image; # If true, an URL to an image
my $magazine = $article->magazine; # Magazine code
# do some work
}