Sah::S...on_meta(3pm)
π NAME π
Sah::Schema::rinci::function_meta β ok bestie, this is the Rinci function metadata schema, and it's lowkey the main character of this whole page. β¨
This page is your girl Sah::S...on_meta(3pm), she's a little shy about her full name in the header but we know who she is π«Ά
πΈ VERSION πΈ
This doc describes version 1.1.98.0 of Sah::Schema::rinci::function_meta (she ships in the Perl distribution Sah-Schemas-Rinci), and she was released on 2021-07-20. Time flies fr fr π¦
β¨ SYNOPSIS β¨
π
Wanna check your data against this schema? (needs Data::Sah)
use Data::Sah qw(gen_validator);
my $validator = gen_validator("rinci::function_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.
Not me obsessed with one schema doing all that. One schema, many validators, other languages?? It's giving β¨multilingual iconβ¨ iykyk π
π Wanna validate function parameters against this schema? (needs Params::Sah)
use Params::Sah qw(gen_validator);
sub myfunc {
my @args = @_;
state $validator = gen_validator("rinci::function_meta*");
$validator->(\@args);
...
}
state $validator staying cached across calls is the moment, honestly. Efficiency queen π
π Wanna put this schema inside Rinci function metadata and let Perinci::CmdLine build you a CLI?
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::function_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 ...
Metadata in, whole CLI out. That's the pipeline, bestie, and it ate π₯
π Sample data (vibe check β )
{} # valid
{args=>{a1=>{},a2=>{}},summary=>"Some function",v=>1.1} # valid
Both valid!! Empty hash? valid. Full-on function metadata with args, summary and v? Also valid. Versatile π
π HOMEPAGE π
Go visit the project's homepage, it's right here: <https://metacpan.org/release/Sah-Schemas-Rinci>. Do it for her π₯Ί
π¦ SOURCE π¦
The source repo lives at <https://github.com/perlancar/perl-Sah-Schemas-Rinci>. Come through, the code is right there π«Ά
π BUGS π
Found a bug? Got a feature request? Please report it on the bugtracker website: <https://rt.cpan.org/Public/Dist/Display.html?Name=Sah-Schemas-Rinci>
And listen bestie, when you submit a bug or a request, please include a test-file β or a patch to an existing test-file β that shows off the bug or the feature you want. No test file = the maintainers are just guessing at your vibe, and that's not the move π
π AUTHOR π
perlancar <perlancar@cpan.org> β the actual legend behind all of this π
π COPYRIGHT AND LICENSE π
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. Free software, free to share, iconic behavior periodt π
Okay that's the whole page, we made it!! π This was rendered by perl v5.36.0 on 2022-11-19, and this little manpage name is Sah::S...on_meta(3pm) in case you ever need to find her again. Byeee, go validate something π¦π
π¦ where this page comes from
- debian bookworm: libsah-schemas-rinci-perl 1.1.98.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsah-schemas-rinci-perl 1.1.98.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsah-schemas-rinci-perl 1.1.98.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsah-schemas-rinci-perl 1.1.98.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsah-schemas-rinci-perl 1.1.98.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms