App::Rssfilter::Feed::Storage - load and save RSS feeds as files
version 0.07
use App::Rssfilter::Feed::Storage; my $fs = App::Rssfilter::Feed::Storage->new( path => 'Hi-type feeds', name => 'Hello', ); print 'last update of feed was ', $fs->last_modified, "\n"; print 'what we got last time: ', $fs->load_existing, "\n"; $fs->save_feed( Mojo::DOM->new( "<hi>hello</hi>" ) ); print 'now it is: ', $fs->load_existing, "\n";
This module saves and loads RSS feeds to and from files, where the file name is based on a group and feed name. It is the default implementation used by App::Rssfilter::Feed for storing & retreiving feeds.
It consumes the App::Rssfilter::Logger role.
This is a object used for logging; it defaults to a Log::Any object. It is provided by the App::Rssfilter::Logger role.
This is the directory path to the stored feed file. If not specified, the current working directory will be used. It is coerced into a Path::Class::Dir object, if it is a string specifying an absolute or relative directory path, or an array or arrayref of directory names (which will be joined to form a directory path).
This is the name of the feed, and will be used as the filename to store the feed under.
This is the last time the stored RSS feed was saved, as a HTTP date string suitable for use in a Last-Modified header. If the feed has never been saved, returns Thu, 01 Jan 1970 00:00:00 GMT. It cannot be set from the constructor.
Last-Modified
Thu, 01 Jan 1970 00:00:00 GMT
my $new_fs = $fs->path_push( @paths );
Returns a clone of this object whose path has had @paths appended to it.
@paths
my $new_fs = $fs->set_name( $new_name );
Returns this object if its name is already $new_name, else returns a clone of this object with its name set to $name.
$new_name
$name
print $fs->load_existing->to_xml;
Returns a Mojo::DOM object initialised with the content of the previously-saved feed. If the feed has never been saved, returns a Mojo::DOM object initialised with an empty string.
$fs->save_feed( Mojo::DOM->new( '<rss> ... </rss>' ) );
Saves a Mojo::DOM object (or anything with a to_xml method), and updates last_modified().
to_xml
last_modified()
Daniel Holz <dgholz@gmail.com>
This software is copyright (c) 2013 by Daniel Holz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::Rssfilter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Rssfilter
CPAN shell
perl -MCPAN -e shell install App::Rssfilter
For more information on module installation, please visit the detailed CPAN module installation guide.