YAML::P...::IxHash(3)

πŸ’… YAML::PP::Schema::Tie::IxHash πŸ’…

okay bestie, this page is straight out of the User Contributed Perl Documentation β€” folding that manual name in right here so you know the vibe πŸŽ€. Buckle up, because this one is deprecated but still iconic for ordered-hash dumping.


🌸 NAME 🌸

YAML::PP::Schema::Tie::IxHash - (Deprecated) Schema for serializing ordered hashes

✨ SYNOPSIS ✨

Here's the whole little ritual, no cap:

use YAML::PP;
use Tie::IxHash;
my $yp = YAML::PP->new( schema => [qw/ + Tie::IxHash /] );

tie(my %ordered, 'Tie::IxHash');
%ordered = (
    U => 2,
    B => 52,
);

my $yaml = $yp->dump_string(\%ordered);

# Output:
---
U: 2
B: 52

πŸ’– DESCRIPTION πŸ’–

Okay so this is deprecated. Like, for real. See the new option preserve in YAML::PP πŸ’….

This schema lets you dump ordered hashes that are tied to Tie::IxHash. It's giving ordered-hash realness and we love that for you ✨.

Also heads up: this code is pretty new and experimental πŸ§ͺ.

Loading? not yet implemented for loading yet, so for now you have to tie the hashes yourself. No magical auto-tie, bestie πŸ™ˆ.

Examples:

order

# Code
tie(my %order, 'Tie::IxHash');
%order = (
    U => 2,
    B => 52,
    c => 64,
    19 => 84,
    Disco => 2000,
    Year => 2525,
    days_on_earth => 20_000,
);
\%order;

Then the YAML it gives you:

# YAML
---
U: 2
B: 52
c: 64
19: 84
Disco: 2000
Year: 2525
days_on_earth: 20000

order_blessed

# Code
tie(my %order, 'Tie::IxHash');
%order = (
    U => 2,
    B => 52,
    c => 64,
    19 => 84,
    Disco => 2000,
    Year => 2525,
    days_on_earth => 20_000,
);
bless \%order, 'Order';

And the blessed YAML:

# YAML
--- !perl/hash:Order
U: 2
B: 52
c: 64
19: 84
Disco: 2000
Year: 2525
days_on_earth: 20000

🫢 METHODS 🫢

register

Called by YAML::PP::Schema


that's the whole page, bestie πŸ’– source/version is perl v5.42.0, date is 2026-04-24, and the page is YAML::P...::IxHash(3) β€” now go tie those hashes with main character energy πŸ‘‘βœ¨.

πŸ“¦ where this page comes from