MooseX::YAML(3pm)
π MooseX::YAML β¨
okay bestie, welcome to MooseX::YAML β the Perl module that does DWIM loading of Moose objects from YAML π¦. yeah. you read that right. your YAML can just... become a Moose object. no cap.
πΈ SYNOPSIS πΈ
so like, imagine you got a class, right? π
# 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) }
and then you just... load an object like so, and it works?? π
# 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
it's giving β¨magicβ¨. and yes, BUILD got called, we don't do half-measures here π₯
π DESCRIPTION π
okay so this module provides DWIM loading of Moose based objects from YAML documents. that's the whole vibe. π«Ά
Any hashes blessed into a Moose class will be replaced with a properly constructed instance β and when I say properly, I mean it respects init args, BUILDALL, and the meta instance type. no shortcuts. ate. π
This is similar to YAML::Active in that certain nodes in the loaded YAML documented are treated specially. π (yes, some nodes get main character energy and get handled differently. iykyk.)
π EXPORTS π
All exports are setup by Sub::Exporter using currying. fancy, i know. β¨
-xs, -syck or -pp can be specified to specify YAML::XS, YAML::Syck or YAML on a per import basis. pick your fighter. π₯
If no driver is explicitly chosen YAML::XS will be tried first, falling back to YAML. so like, it's got a plan A and a plan B, we love a resilient queen π
π The Actual Exports
Loadβ yeah, this one. it loads. π«LoadFileβ and this one loads from a file, obviously. π
π¦ 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. old school? maybe. iconic? absolutely. π
π AUTHOR π
Yuval Kogman <nothingmuch@woobling.org> β the legend, the moment, the blueprint π
β COPYRIGHT β
Copyright (c) 2008 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
tl;dr: free software, same terms as Perl itself, redistribute and/or modify away, bestie π
and that's the whole page!! this lil doc lives in perl v5.30.0, dated 2020-02-10, and it's part of the User Contributed Perl Documentation for MooseX::YAML(3pm) π
okay bye bestie, go bless some hashes π¦β¨π
π¦ where this page comes from
- debian bookworm: libmoosex-yaml-perl 0.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-yaml-perl 0.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmoosex-yaml-perl 0.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-yaml-perl 0.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms