Fotango Ltd > Froody-42 > Froody::Walker;

Download:
Froody-42.tar.gz

Annotate this POD

CPAN RT

Open  0
Report a bug
Source   Latest Release: Froody-42.041_2

NAME ^

Froody::Walker;

SYNOPSIS ^

  my $spec        = $froody_method->structure;
  my $method_name = $froody_method->name;
  
  # create a new walker that knows about the spec
  my $walker = Froody::Walker::TerseToXML->new($source);
  
  # walk $source turning it into xml
  my $xml = $walker->walk($spec, $method_name);

DESCRIPTION ^

Walker classes are constructed with a data source. We can then ask them to convert, using a specification, that data source into another format.

A walker object has its data source (the 'original data structure'), as well as its state (an 'opaque data structure' which we're constructing).

The following methods are used to combine the states, according to the response structure, to a final wanted object.

You need to subclass Froody::Walker to implement a walker which will define how the data source is walked and presented.

METHODS

$class->new(@arg)
$self->walk($spec, $method_name)

Method that's designed to be called on the root node. Walks the data structure we're configured with from the top and returns the new data structure. $method_name is used for debugging info.

$self->walk_node($spec, $xpath_key, $method_name)

Walks the data structure this object holds with the specification, starting at the part of the spec indicated by $xpath_key. The $method_name is used for debugging info.

$self->name
$self->get_child_walkers

Returns a child walker node for each child element of the data structure that we hold.

calculate_value

Set the opaque data structure value from the original data structure value. i.e. copy the text across from one node to the other.

calculate_attribute($name)

Set the walker node attribute in the opaque datastructure called $name from the original data structure

associate_opaque_ds($name => $opaque_ds, $multi)

Set the value of child $name to $childvalue. $multi is true if the child is declared to have multiple values.

is_leaf

Returns true if the node is leaf.

opaque_ds

Returns the opaque datastructure that this walker has constructed to represent the new data source.

BUGS ^

None known.

Please report any bugs you find via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Froody

AUTHOR ^

Copyright Fotango 2005. All rights reserved.

Please see the main Froody documentation for details of who has worked on this project.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Froody, Froody::Response::Terse