MooseX::YAML(3pm)

MooseX::YAML3pm

Dwim loading of moose objects from yaml

Usage

        # given some class:
        package My::Module;
        use Moose;
        has package => (
                is => "ro",
                init_arg => "name",
        );
        has version => (
                is  => "rw",
                init_arg => undef,
        );
        sub BUILD { shift->version(3) }
        # load an object like so:       
        use MooseX::YAML qw(Load -xs);
        my $obj = Load(<<'YAML');
        --- !My::Module # this syntax requires YAML::XS
        name: "MooseX::YAML"
        YAML
        $obj->package; # "MooseX::YAML"
        $obj->version; # 3, BUILD was called

Overview

This module provides DWIM loading of Moose based objects from YAML documents.

Any hashes blessed into a Moose class will be replaced with a properly constructed instance (respecting init args, "BUILDALL", and the meta instance type).

This is similar to YAML::Active in that certain nodes in the loaded YAML documented are treated specially.

Exports

All exports are setup by Sub::Exporter using currying.

"-xs", "-syck" or "-pp" can be specified to specify YAML::XS, YAML::Syck or YAML on a per import basis.

If no driver is explicitly chosen YAML::XS will be tried first, falling back to YAML.

Load
LoadFile

Version control

This module is maintained using Darcs. You can get the latest version from <http://nothingmuch.woobling.org/code>, and use "darcs send" to commit changes.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 2 times.

  1. 6.0–9
  2. 10
  3. 11–13

Author

Yuval Kogman <[email protected]>

From libmoosex-yaml-perl 0.05-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.