MooseX::YAML(3pm)

πŸ“¦
version 0.05 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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 (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