Aranea::XML::CandidateEntry

CONTENTS


NAME

Aranea::XML::CandidateEntry - object representing an entry in the <candidate_list> of an Aranea XML object


SYNOPSIS


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


DESCRIPTION

The CandidateEntry object represents a single entry inside the candidate_list section of an Aranea XML object. Here is an example:


  <entry>
    <support>
      <doc> http://www.foo.com/url1.html </doc>
      <doc> http://www.bar.com/url2.html </doc>
    </support>
    <score>63</score>
    <candidate>Central America</candidate>
  </entry>

The CandidateList object serves as a container for a collection of CandidateEntrys.


METHODS

new($candidate, $score)
Constructs a CandidateEntry given a candidate and a score for that candidate.

candidate([$candidate])
Accesses or mutates the candidate answer.

score([$score])
Accesses or mutates the score of the candidate answer.

projection_score([$score])
Accesses or mutates the projection score of the candidate answer.

support([$support])
Accesses or mutates the support of the candidate answer. This method of access is not preferred because it returns a hashref, which directly reflects the underlying XML structure. Instead, use the support_docs method.

add_support($url)
Adds a URL to the list of supporting documents.

support_count($url)
Returns the number of supporting URLs. Note that the return value is similiar to that of $#, i.e., -1 for no entries, 0 for one entry, etc.

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

write_xml($writer)
Writes the XML representation of this CandidateList; 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.