NAME

Data::Transform::Reference - freeze and thaw arbitrary Perl data

SYNOPSIS

use YAML;
use Data::Transform::Reference;

my $filter = Data::Transform::Reference->new(
  serialize   => YAML->can('Dump');
  deserialize => YAML->can('Load');
);

...
my $string = $filter->put($some_var);

...
my $other_var = $filter->get($serialized_var);

DESCRIPTION

Data::Transform::Reference allows programs to send and receive arbitrary Perl data structures without worrying about a line protocol. Its put() method serializes Perl data into a byte stream suitable for transmission. get_one() parses the data structures back out of such a stream.

METHODS

Data::Transform::Reference implements the standard Data::Transform API. Only the differences are documented here.

new

new() creates and initializes a Data::Transform::Reference object. It requires the following parameters:

serializer

A code ref used to serialize data. Good candidates for this are nfreeze() from Storable or Dump() from a YAML implementation.

deserializer

A code ref used to de-serialize data. Good candidates for this are thaw() from Storable or Load() from a YAML implementation.

Both code references are expected to accept a single parameter containing the data on which to act on.

SEE ALSO

Please see Data::Transform for documentation regarding the base interface.

CAVEATS

It's important to use identical serializers on each end of a connection. Even different versions of the same serializer can break data in transit.

Most (if not all) serializers will rebless data at the destination, but many of them will not load the necessary classes to make their blessings work.

AUTHORS & COPYRIGHTS

The original Reference filter was contributed by Artur Bergman, with changes by Philip Gwyn. Martijn van Beers simplified the API when starting Data::Transform