GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
POE::Component::RSS(3) User Contributed Perl Documentation POE::Component::RSS(3)

POE::Component::RSS - Event based RSS parsing

  use POE qw(Component::RSS);

  POE::Component::RSS->spawn();

  $kernel->post(
    'rss', 
    'parse' => {
      Item => 'item_state',
    },
    $rss_string
  );

POE::Component::RSS is an event based RSS parsing module. It wraps XML::RSS and provides a POE based framework for accessing the information provided.

RSS parser components are not normal objects, but are instead 'spawned' as separate sessions. This is done with PoCo::RSS's 'spawn' method, which takes one named parameter:
"Alias => $alias_name"
'Alias' sets the name by which the session is known. If no alias is given, the component defaults to 'rss'. It's possible to spawn several RSS components with different names.

Sessions communicate asynchronously with PoCo::RSS - they post requests to it, and it posts results back.

Parse requests are posted to the component's "parse" state, and include a hash of states to return results to, and a RSS string to parse, followed by an optional identity parameter. For example:

  $kernel->post(
    'rss', 
    'parse' => { # hash of result states
      Item      => 'item_state',
      Channel   => 'channel_state',
      Image     => 'image_state',
      Textinput => 'textinput_state',
      Start     => 'start_state',
      Stop      => 'stop_state',
    },
    $rss_string, $rss_identity_tag);

Currently supported result events are:

"Item => 'item_state'"
A state to call every time an item is found within the RSS file. Called with a reference to a hash which contains all attributes of that item.
"Channel => 'channel_state'"
A state to call every time a channel definition is found within the RSS file. Called with a reference to a hash which contains all attributes of that channel.
"Image => 'image_state'"
A state to call every time an image definition is found within the RSS file. Called with a reference to a hash which contains all attributes of that image.
"Textinput => 'textinput_state'"
A state to call every time a textinput definition is found within the RSS file. Called with a reference to a hash which contains all attributes of that textinput.
"Start => 'start_state'"
A state to call at the start of parsing.
"Stop => 'stop_state'"
A state to call at the end of parsing.

If an identity parameter was supplied with the parse event, the first parameter of all result events is that identity string. This allows easy identification of which parse a result is for.

  • Some events may be emitted even if no data was found. Calling code should check return data to verify content.
  • This really needs to be rewritten using "POE::Filter::XML". Of course, I've been saying that for a few years now...

  • Matt Cashner - sungo@pobox.com
  • Michael Stevens - michael@etla.org

Copyright (c) 2004, Matt Cashner. All rights reserved.

Copyright (c) 2002, Michael Stevens. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the Matt Cashner nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2008-12-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.