• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H20-Feb-2017-5948

lib/POE/Component/IRC/Plugin/RSS/H20-Feb-2017-26299

t/H20-Feb-2017-151102

ChangesH A D20-Feb-2017604 1813

LICENSEH A D20-Feb-201717.9 KiB380292

MANIFESTH A D20-Feb-2017302 1615

META.jsonH A D20-Feb-20171.8 KiB6866

META.ymlH A D20-Feb-2017952 3332

Makefile.PLH A D20-Feb-20171.7 KiB6958

READMEH A D20-Feb-20173.5 KiB13592

dist.iniH A D20-Feb-2017439 2519

README

1NAME
2
3    POE::Component::IRC::Plugin::RSS::Headlines - A POE::Component::IRC
4    plugin that provides RSS headline retrieval.
5
6VERSION
7
8    version 1.10
9
10SYNOPSIS
11
12      use strict;
13      use warnings;
14      use POE qw(Component::IRC Component::IRC::Plugin::RSS::Headlines);
15
16      my $nickname = 'RSSHead' . $$;
17      my $ircname = 'RSSHead the Sailor Bot';
18      my $ircserver = 'irc.perl.org';
19      my $port = 6667;
20      my $channel = '#IRC.pm';
21      my $rss_url = 'http://eekeek.org/jerkcity.cgi';
22
23      my $irc = POE::Component::IRC->spawn(
24            nick => $nickname,
25            server => $ircserver,
26            port => $port,
27            ircname => $ircname,
28            debug => 0,
29            plugin_debug => 1,
30            options => { trace => 0 },
31      ) or die "Oh noooo! $!";
32
33      POE::Session->create(
34            package_states => [
35                    'main' => [ qw(_start irc_001 irc_join irc_rssheadlines_items) ],
36            ],
37      );
38
39      $poe_kernel->run();
40      exit 0;
41
42      sub _start {
43        # Create and load our plugin
44        $irc->plugin_add( 'RSSHead' =>
45            POE::Component::IRC::Plugin::RSS::Headlines->new() );
46
47        $irc->yield( register => 'all' );
48        $irc->yield( connect => { } );
49        undef;
50      }
51
52      sub irc_001 {
53        $irc->yield( join => $channel );
54        undef;
55      }
56
57      sub irc_join {
58        my ($kernel,$sender,$channel) = @_[KERNEL,SENDER,ARG1];
59        print STDERR "$channel $rss_url\n";
60        $kernel->yield( 'get_headline', { url => $rss_url, _channel => $channel } );
61        undef;
62      }
63
64      sub irc_rssheadlines_items {
65        my ($kernel,$sender,$args) = @_[KERNEL,SENDER,ARG0];
66        my $channel = delete $args->{_channel};
67        $kernel->post( $sender, 'privmsg', $channel, join(' ', @_[ARG1..$#_] ) );
68        undef;
69      }
70
71DESCRIPTION
72
73    POE::Component::IRC::Plugin::RSS::Headlines, is a POE::Component::IRC
74    plugin that provides a mechanism for retrieving RSS headlines from
75    given URLs.
76
77CONSTRUCTOR
78
79    new
80
81      Creates a new plugin object. Takes the following optional arguments:
82
83        'http_alias', you may provide the alias of an existing POE::Component::Client::HTTP
84                      component that the plugin will use instead of spawning it's own;
85        'follow_redirects', this argument is passed to PoCoCl::HTTP to inform it how to deal with
86                      following redirects, default is 2;
87
88INPUT EVENTS
89
90    The plugin registers the following state handler within your session:
91
92    get_headline
93
94      Takes a hashref as an argument with the following keys:
95
96        'url', the RSS based url to retrieve items for;
97
98      You may pass arbitary key/value pairs, but the keys must be prefixed
99      with an underscore.
100
101OUTPUT
102
103    The following irc event is generated with the result of a
104    'get_headline' command:
105
106    irc_rssheadlines_items
107
108      Has the following parameters:
109
110        'ARG0', the original hashref that was passed;
111        'ARG1' .. $#_, RSS headline item titles;
112
113    irc_rssheadlines_error
114
115      Has the following parameters:
116
117        'ARG0', the original hashref that was passed;
118        'ARG1', the error text;
119
120SEE ALSO
121
122    POE::Component::IRC
123
124AUTHOR
125
126    Chris Williams
127
128COPYRIGHT AND LICENSE
129
130    This software is copyright (c) 2017 by Chris Williams.
131
132    This is free software; you can redistribute it and/or modify it under
133    the same terms as the Perl 5 programming language system itself.
134
135