forked from CougarCS/autobahn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_pcfa_session.pl
executable file
·44 lines (33 loc) · 945 Bytes
/
test_pcfa_session.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl
use v5.012;
use strict;
use warnings;
use POE qw(Component::FeedAggregator);
use Log::Log4perl;
sub new_feed_entry {
my ( $self, @args ) = @_[ OBJECT, ARG0..$#_ ];
print "in the event";
my $feed = $args[0]; # POE::Component::FeedAggregator::Feed object of the feed
my $entry = $args[1]; # XML::Feed::Format::* object of the new entry
#use DDP; p $feed;
use DDP; p $entry->title;
};
sub _start {
my $agg = POE::Component::FeedAggregator->new();
unlink 'bbc.feedcache';
$agg->add_feed({
url => 'http://feeds.bbci.co.uk/news/rss.xml', # required
name => 'bbc', # required
delay => 5, # default value
ignore_first => 0,
entry_event => 'new_feed_entry', # default value
});
}
POE::Session->create(
inline_states => {
'_start' => \&_start,
'new_feed_entry' => \&new_feed_entry,
}
);
POE::Kernel->run();
1;