Sah::S...::meta(3pm)

πŸ“¦
version 1.1.98.0 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Sah::Schema::rinci::meta β€” it's giving Rinci metadata πŸ’… that's literally the whole vibe, bestie.


🌸 VERSION 🌸

okay so this doc is describing version 1.1.98.0 of Sah::Schema::rinci::meta (she comes from the Perl distribution Sah-Schemas-Rinci), and she was released on 2021-07-20. iconic behavior, no cap πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

So like, there's a few ways you can pull up on this schema depending on what you're trying to do, and I'm gonna walk you through all of them 🫢

Wanna check data against this schema? (needs Data::Sah)

use Data::Sah qw(gen_validator);
my $validator = gen_validator("rinci::meta*");
say $validator->($data) ? "valid" : "INVALID!";

# Data::Sah can also create validator that returns nice error message string
# and/or coerced value. Data::Sah can even create validator that targets other
# language, like JavaScript. All from the same schema. See its documentation
# for more details.

the range!!! β€” one schema, so many outputs, we love a versatile queen πŸ‘‘

Wanna validate function params against this schema? (needs Params::Sah)

use Params::Sah qw(gen_validator);

sub myfunc {
    my @args = @_;
    state $validator = gen_validator("rinci::meta*");
    $validator->(\@args);
    ...
}

Wanna specify the schema in Rinci function metadata and then let Perinci::CmdLine build you a whole CLI out of it? say less 😌

# in lib/MyApp.pm
package
  MyApp;
our %SPEC;
$SPEC{myfunc} = {
    v => 1.1,
    summary => 'Routine to do blah ...',
    args => {
        arg1 => {
            summary => 'The blah blah argument',
            schema => ['rinci::meta*'],
        },
        ...
    },
};
sub myfunc {
    my %args = @_;
    ...
}
1;

# in myapp.pl
package
  main;
use Perinci::CmdLine::Any;
Perinci::CmdLine::Any->new(url=>'MyApp::myfunc')->run;

# in command-line
% ./myapp.pl --help
myapp - Routine to do blah ...
...

% ./myapp.pl --version

% ./myapp.pl --arg1 ...

a whole CLI from metadata?? she ate and left no crumbs fr fr πŸ”₯

Sample data, so you know what passes the vibe check πŸ’–

{}  # valid

{summary=>"Some summary"}  # valid

πŸŽ€ HOMEPAGE πŸŽ€

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

https://metacpan.org/release/Sah-Schemas-Rinci


πŸ’– SOURCE πŸ’–

the source repo lives at:

https://github.com/perlancar/perl-Sah-Schemas-Rinci


πŸ’€ BUGS πŸ’€

found a bug? want a feature? please drop it on the bugtracker, she reads them:

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

okay this part is important so listen up πŸ™ˆ β€” when you submit a bug or a request, please include a test-file or a patch to an existing test-file that shows the bug or the thing you want. it makes everything so much easier, tysm 🫢

πŸ‘‘ AUTHOR πŸ‘‘

perlancar</purl> <perlancar@cpan.org> β€” the main character, periodt πŸ’…


This software is copyright (c) 2021, 2020, 2019, 2018, 2016 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. πŸ¦‹


and that's the whole page, bestie!! ✨ this was perl v5.36.0, dated 2022-11-19, and we were reading the manual page for Sah::S...::meta(3pm). mwah, go write something iconic πŸ’–πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from