MooseX...s::JSON(3pm)

πŸ“¦
version 1.01 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

MooseX::Types::JSON β€” it's the JSON datatype for Moose, bestie. That's the whole vibe. πŸ¦‹


✨ VERSION ✨

version 1.01 β€” yeah she's on 1.01, we love a specific girlie. πŸ’…


🌸 SYNOPSIS 🌸

okay so imagine you're just tryna have a Moose class with some JSON-typed attributes. boom:

package Foo;

use Moose;
use Moose::Util::TypeConstraints;
use MooseX::Types::JSON qw( JSON relaxedJSON );

has config  => ( is => 'rw', isa => JSON        );
has options => ( is => 'rw', isa => relaxedJSON );

like… that's it. that's the whole thing. you isa JSON and you're iconic. πŸ‘‘


okay so what even is this package? 🫢

these are string type constraints that match valid JSON and relaxed JSON. and when we say "relaxed", like, what do we even mean by that β€” go read JSON for the meaning of 'relaxed', because that's where the actual definition lives. no cap.

also, and this is the part that lowkey slays: all the heavy lifting in the background is also done by JSON. she's not doing the work herself, she's outsourcing it. main character delegation energy. πŸ’€

and bestie, coercions from Defined types are included. you don't have to do anything, they're just… there. gifted to you. πŸŽ€

here's the lineup:

  • JSON β€” a Str that is valid JSON. that's it, that's the requirement. if it parses, she eats. πŸ”₯
  • relaxedJSON β€” a Str that is 'relaxed' JSON. and again β€” for the meaning of 'relaxed' see JSON, because we are NOT redefining that here, we are respecting the source material. periodt. πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

Author: Graham Ollis <plicease@cpan.org> β€” the actual legend behind this. πŸ’–

Contributors:

  • Steve Huff

(shoutout Steve, we see you 🫑)


This software is copyright (c) 2014,2022 by Michael Langner. πŸ’«

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like… go off, remix it, it's yours to play with. just keep it Perl-flavored. 🌸


and that's the whole page, bestie!! 🧚 this was pulled straight from perl v5.32.1, dated 2022-01-23 β€” yes she's a little vintage, no she is NOT expired. iconic behavior, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from