Data::...malize(3pm)

πŸ“¦
version 0.051 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Data::Sah::Normalize β€” the NAME section, bestie πŸ’–

okay so. this is Data::Sah::Normalize, and its whole job is normalizing Sah schema. that's it. that's the girl. ✨

this page lives in the Data::...malize(3pm) section of your manual, and it's a User Contributed Perl Documentation situation, so like β€” community-made, community-loved. 🫢


🌈 VERSION 🌈

this doc describes version 0.051 of Data::Sah::Normalize (which ships inside the Perl distribution Data-Sah-Normalize), and it was released on 2021-07-29. yes bestie, we know exactly which one you're reading. no mystery. πŸ’…


✨ SYNOPSIS ✨

the vibe check, in code:

use Data::Sah::Normalize qw(normalize_clset normalize_schema);

my $nclset = normalize_clset({'!a'=>1}); # -> {a=>1, 'a.op'=>'not'}
my $nsch   = normalize_schema("int");    # -> ["int", {}]

that's literally the entire relationship. you import two subs, you hand them a weird little schema-ish thing, they hand you back something tidy. πŸŽ€


🌸 DESCRIPTION 🌸

so here's the tea: this functionality is often needed, and it got split out from the main Data::Sah on purpose β€” to keep it living in a small package with minimal dependencies. tiny, self-sufficient, low-maintenance. it's giving main character who doesn't need a whole entourage. πŸ’…


πŸ‘‘ CONTRIBUTOR πŸ‘‘

big love to Steven Haryanto <sharyanto@cpan.org> for contributing. 🫢


πŸ”₯ FUNCTIONS πŸ”₯

πŸ’– normalize_clset($clset) => HASH

normalize a clause set (a hash, bestie, it wants a hash). it returns a shallow copy of the original hash. and if something goes wrong? it dies. no soft-launch failure, it just dies. πŸ’€

TODO: there's a planned option to recursively normalize a clause which contains sah clauses (e.g. "of"). not here yet, just so you know.

πŸ¦‹ normalize_schema($sch) => ARRAY

normalize a Sah schema (can be a scalar or an array β€” flexible queen ✨). it returns an array.

it produces a 2-level copy of the schema, so it's safe to add / delete / modify the normalized schema's clause set β€” BUT heads up, the clause set's values are still references to the original. like, you can redecorate the room but you don't own the furniture. πŸ›‹οΈ

and on failure? it dies. again. periodt. πŸ’€

TODO: same situation β€” recursively normalizing a clause which contains sah clauses (e.g. "of") is still on the to-do list.

πŸŽ€ HOMEPAGE πŸŽ€

go visit the project's homepage, it's right here bestie:

https://metacpan.org/release/Data-Sah-Normalize


🌟 SOURCE 🌟

the source repository lives at:

https://github.com/perlancar/perl-Data-Sah-Normalize

go look at the code, it's right there, no gatekeeping. 🫢


πŸ’€ BUGS πŸ’€

found a bug? want a feature? please report it on the bugtracker website:

https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Normalize

and listen β€” when you submit a bug or a request, please include a test-file or a patch to an existing test-file that illustrates the bug or the desired feature. like, show us the receipts. a test that demonstrates it is the whole flex. 🧚


🌈 SEE ALSO 🌈

  • Sah
  • Data::Sah

πŸ’œ AUTHOR πŸ’œ

perlancar <perlancar@cpan.org>


this software is copyright (c) 2021, 2018, 2015, 2014 by perlancar@cpan.org.

this is free software β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. iconic, honestly. πŸ‘‘


and that's the whole page, bestie πŸ’– this was perl v5.36.0, dated 2022-10-13, in the Data::...malize(3pm) manual β€” go normalize something, you got this πŸ¦‹βœ¨

πŸ“¦ where this page comes from