Aranea::XML::PageList

CONTENTS


NAME

Aranea::XML::PageList - object representing the <page_list> of an Aranea XML object


SYNOPSIS


  use Aranea::XML::Aranea;
  use Aranea::XML::PageList;
 
  my $stdin = new_from_fd IO::Handle(STDIN, "r");
  my $Aranea = Aranea::XML::Aranea->new($stdin);
 
  my $page_list = $Aranea->page_list();
  my $entries = $page_list->entries();  # arrayref to entries in page list


DESCRIPTION

The PageList object represents the page_list section of an Aranea XML object. Here is an example:


  <page_list>
    <entry>
      <id>0</id>
      <page_summary>here is some text</page_summary>
      <page_cache_url> http://www.foo.com/cache.html </page_cache_url>
      <page_title>Sample</page_title>
      <page_url> http://www.foo.com/sample.html </page_url>
    </entry>
    ...
  </page_list>

The PageList object serves as a container for a collection of PageEntrys. Under normal circumstances, the creation of a PageList should be handled automatically by the Aranea::XML::Aranea object.


METHODS

new($data)
Constructs a PageList object given parsed XML data. Note that this method is rarely invoked manually; under typical usage patterns, the constructor of Aranea::XML::Aranea will call this method automatically.

entries([$listref])
Accesses or mutates the collection of PageEntrys. When called with no arguments, this method returns a listref of PageEntrys. When called with a single listref, the collection of PageEntrys is set to the listref.

The typical usage pattern is to iterate over each page object and perform some action, e.g.,


  my $page_list = $Aranea->page_list();
  my $entries = $page_list->entries();
 
  for my $entry ( @$entries ) {
      # do stuff...
  }

add_entry($entry)
Adds a PageEntry to this PageList.

write_xml($writer)
Writes the XML representation of this PageList; takes an XML::Writer as its only argument. Note that this method is rarely invoked manually; under typical usage patterns, the write_xml method of Aranea::XML::Aranea will call this method automatically.