summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-11-30 21:12:42 -0600
committerJesse Luehrs <doy@tozt.net>2009-11-30 21:12:42 -0600
commit6f14c0b2c354d81be4be7132c574cc474e4d5e2c (patch)
tree173af23c7ac15fdb7df0077b944585903da16cf1
parent89321e1456c210e8e4a4b6593ae84a41fc2bfe3e (diff)
downloadcrawlbot-6f14c0b2c354d81be4be7132c574cc474e4d5e2c.tar.gz
crawlbot-6f14c0b2c354d81be4be7132c574cc474e4d5e2c.zip
XML::RAI is dumb
-rw-r--r--lib/Crawl/Bot/Plugin/Mantis.pm8
-rw-r--r--lib/Crawl/Bot/Role/RSS.pm10
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/Crawl/Bot/Plugin/Mantis.pm b/lib/Crawl/Bot/Plugin/Mantis.pm
index 4ea2db9..6c2fe61 100644
--- a/lib/Crawl/Bot/Plugin/Mantis.pm
+++ b/lib/Crawl/Bot/Plugin/Mantis.pm
@@ -9,7 +9,7 @@ sub rss_feed { 'http://crawl.develz.org/mantis/issues_rss.php' }
sub item_to_id {
my $self = shift;
my ($item) = @_;
- my $link = $item->identifier;
+ my $link = $item->{identifier};
(my $id = $link) =~ s/.*=(\d+)$/$1/;
return $id;
}
@@ -21,9 +21,9 @@ sub tick {
my $id = $self->item_to_id($item);
return if $self->has_item($id);
warn "New issue! ($id)";
- (my $title = $item->title) =~ s/\d+: //;
- my $link = $item->link;
- (my $user = $item->creator) =~ s/ <.*?>$//;
+ (my $title = $item->{title}) =~ s/\d+: //;
+ my $link = $item->{link};
+ (my $user = $item->{creator}) =~ s/ <.*?>$//;
$self->say_all("$title ($link) by $user");
$self->add_item($id);
});
diff --git a/lib/Crawl/Bot/Role/RSS.pm b/lib/Crawl/Bot/Role/RSS.pm
index 8470eee..8576a82 100644
--- a/lib/Crawl/Bot/Role/RSS.pm
+++ b/lib/Crawl/Bot/Role/RSS.pm
@@ -10,7 +10,15 @@ requires 'rss_feed';
sub current_items {
my $self = shift;
my $rss = XML::RAI->parse_uri($self->rss_feed);
- return @{ $rss->items };
+ # after the XML::RAI object goes out of scope, the item objects become
+ # worthless. how dumb. capture the relevant data in some hashrefs instead.
+ return map {
+ my $item = $_;
+ +{
+ map { $_ => $item->$_ }
+ qw(identifier title link creator)
+ }
+ } @{ $rss->items };
}
no Moose::Role;