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

Download:
Froody-42.034.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
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->new($spec, "method name");
  my $terse = Froody::Walker::Terse->new;
  my $xml = Froody::Walker::XML->new;
  $walker->from($terse)->to($xml);
  
  # walk $source turning it into xml
  my $xml = $walker->walk($data);

DESCRIPTION ^

Walker classes are constucted with a description of the structure it will generate. That structure is a very specific grammar listing paths into the object that can be built.

Setting from and to designates the source and targets for the transformation, respectively. We currently provide two data structures Froody::Walker::Terse and Froody::Walker::XML as transformation engines, which will both work bi-directionally.

METHODS

$self->walk($spec, $data)

Walks the structure of data with the source Froody::Walker::Driver, returning a transformed version of the data as per the designation of the target.

$self->walk_node($spec, $source, $xpath_key, [ $parent_target ])

Walks the data structure this object holds with the specification, starting at the part of the spec indicated by $xpath_key.

$parent_target is used for accumulation of results at the current level.

from (Froody::Walker::Driver)

Sets the source driver.

to (Froody::Walker::Driver)

Sets the target driver.

Utility methods

Small methods that get called a lot from subclasses.

spec_for_xpath( path )

Returns the local method spec for the given xpath. Returns the default method spec (text-only node) if there is no spac for that path.

toplevels()

return a list of the top-level node names in the response XML.

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

syntax highlighting: