YAML::P...structor(3)

πŸ’– YAML::P...structor(3) πŸ’–

Okay so this is the YAML::P...structor(3) page from the User Contributed Perl Documentation, and the actual module is YAML::PP::Constructor β€” yes bestie, the title is doing its truncated little thing but we move πŸ’….


🌸 NAME 🌸

YAML::PP::Constructor β€” constructing data structure from parsing events ✨


πŸŽ€ METHODS πŸŽ€

πŸ’… new β€” the Constructor constructor

Build one like this, no cap:

my $constructor = YAML::PP::Constructor->new(
    schema => $schema,
    cyclic_refs => $cyclic_refs,
);

🧚 init

Resets any data being used during construction. Iconic reset behavior:

$constructor->init;

πŸ¦‹ Event methods

These methods are called from YAML::PP::Parser:

$constructor->document_start_event($event);

The whole event squad is document_start_event, document_end_event, mapping_start_event, mapping_end_event, sequence_start_event, sequence_end_event, scalar_event, alias_event, stream_start_event, and stream_end_event πŸ’–.

🌈 Helper method pairs

  • anchors, set_anchors β€” helper for storing anchors during construction πŸŽ€
  • docs, set_docs β€” helper for storing resulting documents during construction πŸ“„
  • stack, set_stack β€” helper for storing data during construction 🧺
  • cyclic_refs, set_cyclic_refs β€” option for controlling the behaviour when finding circular references πŸŒ€
  • schema, set_schema β€” holds a YAML::PP::Schema object πŸ‘‘

πŸ“ stringify_complex

When constructing a hash and getting a non-scalar key, this method is used to stringify the key. It uses a terse Data::Dumper output. Other modules, like YAML::XS, use the default stringification, ARRAY(0x55617c0c7398) for example. Literally the key-glow-up moment πŸ’….


Signed off with perl v5.42.0, dated 2026-04-24, and filed under YAML::P...structor(3) 🫢✨

πŸ“¦ where this page comes from