The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Benchmark::Serialize::Library - Library of serialization modules

VERSION

Version 0.08

SYNOPSIS

    use Benchmark::Serialize::Library;

    Benchmark::Serialize::Library->register(
        MyModule => {
            deflate => sub { MyModule::deflate( $_[0] ) },
            inflate => sub { MyModule::inflate( $_[0] ) },
        }
    );

    my %benchmarks = Benchmark::Serialize::Library->load( ":all" );

DESCRIPTION

This module contains a library of serialization routines for use with Benchmark::Serialize

Library methods

This class provides the following methods

register( NAME => SPECIFICATION )

Registers a new benchmarkable form of serialization. A specification is a hashref containing the following fields:

deflate (required)

A coderef taking one argument (a perl structure) and returns the serialized structure

inflate (required)

A coderef taking one argument (a serialized structure) and returns the perl structure

packages (optional)

A array reference containing modules to be loaded. The default value is the name of the benchmark.

args (optional)

A coderef returning a list of aditional arguments for the deflate and inflate routines. Only run once during initialization of benchmark.

All additional fields are interpreted as tags used for selecting benchmarks.

load NAME|TAG|BENCHMARK ...

Loads and initializes a number of benchmarks. Arguments can be either registered names, registered tags, or unregistered benchmarks following the same format as the register method.

Returns a list of benchmarks

list

Returns a list of all available benchmarks. For each benchmark both the name and the version is returned in a array ref.

Benchmark methods

Each benchmark is represented by a object with the following mathods

deflate

Takes a perl structure as argument and returns the serialized form

inflate

Takes a serialized form as argument and returns the perl structure.

name

Returns the name of the benchmark

version

Returns the module version of the benchmark. For benchmark needing multiple loaded modules, the first in the specification list is used.

Known tags

The following tags are usec in the standard library

:all - All modules with premade benchmarks
:default - A default set of serialization modules
:core - Serialization modules included in core
:json - JSON modules
:yaml - YAML modules
:xml - XML formats

AUTHOR

Peter Makholm, <peter at makholm.net>

BUGS

Please report any bugs or feature requests to bug-benchmark-serialize at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Benchmark-Serialize. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

This module started out as a script written by Christian Hansen, see http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl

COPYRIGHT & LICENSE

Copyright 2009-2010 Peter Makholm.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.