Changeset 17358 for lang/perl/Data-Feed

Show
Ignore:
Timestamp:
08/11/08 09:42:26 (6 years ago)
Author:
daisuke
Message:

docs

Location:
lang/perl/Data-Feed/trunk/lib/Data
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Data-Feed/trunk/lib/Data/Feed.pm

    r17148 r17358  
    6767    # feed ourselves. 
    6868 
    69     # XXX - Make this extensible! 
     69    # XXX - Make this extendable! 
    7070 
    7171    {  
     
    166166parser to do whatever you want it to do. 
    167167 
     168=head1 STRUCTURE 
     169 
     170Data::Feed has a fairly simple structure. The first layer is a "dynamic" 
     171parser -- "dynamic" in that Data::Feed will try to find what the feed is, 
     172and then create the appropriate parser to parse it. 
     173 
     174This is done in Data::Feed->find_parser() and Data::Feed->guess_format(). 
     175By default we recognize RSS and Atom feeds. Should the need arise to  
     176either provide a custom parser or to provide more refined logic to find a 
     177parser type, override the respective method and do what you will with it. 
     178 
     179The second layer is a thin wrapper around RSS and Atom feed objects. 
     180We use XML::RSS::LibXML (or XML::RSS) and XML::Atom for this purpose. 
     181 
     182=head1 PARSING FEEDS 
     183 
     184Data::Feed can parse files, URIs, raw strings, and file handles. All you need 
     185to do is to pass an appropriate parameters. 
     186 
     187For file names, we expect a plain scalar: 
     188 
     189  Data::Feed->parse( '/path/to/feed.xml' ); 
     190 
     191For URI (which we will fetch via URI::Fetch), pass in an URI object: 
     192 
     193  Data::Feed->parse( URI->new("http://example.com/feed.xml") ); 
     194 
     195For raw strings, pass in a scalar ref: 
     196 
     197  Data::Feed->parse( \qq{<?xml version="1.0"><feed> .... </feed>} ); 
     198 
     199For file handles, pass in a glob: 
     200 
     201  open(my $fh, '<', '/path/to/feed.xml' ); 
     202  Data::Feed->parse( $fh ); 
     203 
    168204=head1 METHODS 
    169205 
     
    171207 
    172208=head2 find_parser($stream) 
     209 
     210Attempts to find an appropriate parser for the given stream. 
    173211 
    174212=head2 guess_format($stream) 
  • lang/perl/Data-Feed/trunk/lib/Data/Feed/Parser/RSS.pm

    r17139 r17358  
    4848Data::Feed::Parser::RSS - Data::Feed RSS Parser 
    4949 
     50=head1 DESCRIPTION 
     51 
     52Attempts to parse the given scalar reference (which should contain a valid 
     53RSS xml), using either XML::RSS::LibXML or XML::RSS (whichever one that is 
     54found first will be used) 
     55 
     56As of this writing, XML::RSS has some limitations (particularly with enclosures) 
     57so, it is best to stick with XML::RSS::LibXML as long as you have libxml2 
     58and XML::LibXML installed in your system. 
     59 
    5060=head1 METHODS 
    5161