Egg::Model::FeedPP - XML::FeedPP for Egg::Model.


Egg-Release-XML-FeedPP documentation Contained in the Egg-Release-XML-FeedPP distribution.

Index


Code Index:

NAME

Top

Egg::Model::FeedPP - XML::FeedPP for Egg::Model.

SYNOPSIS

Top

configuration.

  ...
  MODEL=> [
    .....
    [ FeedPP=> {} ],
    ],

example code.

  my $param= $view->params;
  my $feed = $e->model('FeedPP')->feed('http://mydomain.name/index.rdf');
  $param->{rss_title}= $feed->title;
  $param->{rss_link} = $feed->link;
  my @items;
  for $item ($feed->get_item) {
    push @items, {
      title=> $item->title,
      link => $item->link,
      date => $item->pubDate,
      };
  }
  $param->{rss_items}= \@items;

DESCRIPTION

Top

It is a module to use XML::FeedPP with MODEL.

The XML::FeedPP object will be usually received by the feed method, and you operate the object directly though you do the method of XML::FeedPP with AUTOLOAD in bind.

* Functions other than relaying XML::FeedPP are not provided now.

CONFIGURATION

Top

'FeedPP' is added to the setting of MODEL.

  MODEL => [
    [ FeedPP => {} ],
    ],

* There is no set item of the option now.

METHODS

Top

feed ( [SOURCE] )

XML::FeedPP object is returned.

SOURCE is an argument passed to the constructor of XML::FeedPP.

  my $feed= $e->model('FeedPP')->feed('http://domain.name/index.rss');

* Please see the document of XML::FeedPP in detail.

SEE ALSO

Top

XML::FeedPP, Egg::Release,

AUTHOR

Top

Masatoshi Mizuno <lushe&64;cpan.org>

COPYRIGHT

Top


Egg-Release-XML-FeedPP documentation Contained in the Egg-Release-XML-FeedPP distribution.
package Egg::Model::FeedPP;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: FeedPP.pm 187 2007-08-07 19:00:30Z lushe $
#
use strict;
use warnings;
use Carp qw/croak/;
use base qw/Egg::Model/;
use XML::FeedPP;

our $VERSION = '0.01';


our $AUTOLOAD;

sub feed {
	my $model = shift;
	my $source= shift || croak q{ I want source. };
	$model->{feed}= XML::FeedPP->new($source);
}
sub AUTOLOAD {
	my $model= shift;
	$model->{feed} || croak q{ feed is not prepared. };
	my($method)= $AUTOLOAD=~/([^\:]+)$/;
	no strict 'refs';  ## no critic
	no warnings 'redefine';
	*{__PACKAGE__."::$method"}= sub { shift->{feed}->$method(@_) };
	$model->$method(@_);
}
sub DESTROY { }

1;