Rinci::Upgrading(3pm)
π NAME π
Rinci::Upgrading β bestie, this is the glow-up guide for moving your metadata from the old version to the new one β¨
πΈ VERSION πΈ
This doc describes version 1.1.104 of Rinci::Upgrading, straight out of the Perl distribution Rinci, and it dropped on 2023-09-30. She's not new-new but she's iconic π
π¦ DESCRIPTION π¦
Okay so this is literally your step-by-step for converting your metadata from an older version. Glow-up time π
The examples are written in Perl, but like... don't feel locked in? They're not limited to this language π«Ά
π UPGRADING FROM SUB::SPEC 1.0 TO RINCI 1.1 π
β¨ Upgrading function metadata β¨
If you're in Perl, you can just let Perinci::Sub::Wrapper do the heavy lifting β and fun fact, Perinci::Access uses that same thing internally β to automatically convert Sub::Spec 1.0 metadata to 1.1. So if you want, you can literally skip this whole document. No cap π
Terminology change, part one: (sub) spec is now called metadata. Why? Because there's now metadata for functions and for other code entities like variables, packages, etc. She's versatile πββοΈ
Terminology change, part two: clause is now called property. The reason is to avoid confusion with Data::Sah's clause. Different word, different vibe, no crossover episodes π«
The v (spec version) property is required, so add this:
v => 1.1
to your function metadata. Don't forget, bestie, it's mandatory π
Each argument in the args property is now a hash, instead of a schema. So:
- Move the schema to the
schemakey of the hash. - To specify a required argument, add
reqset to1to the hash key. - Move the
arg_posSah clause to theposhash key. - Move the
arg_greedySah clause to thegreedyhash key. - Move the
arg_completionSah clause to thecompletionhash key.
Example time π β change this:
args => {
# a required argument
arg1 => ['int*', {
summary => 'Blah ...',
min => 1, max => 100,
arg_pos => 0,
}],
# an optional argument
arg2 => ['bool', {
summary => 'Blah ...',
default => 0,
}],
}
Into this:
args => {
arg1 => {
summary => 'Blah ...',
schema => ['int*', {min=>1, max=>100}],
req => 1,
pos => 0,
},
arg2 => {
summary => 'Blah ...',
schema => [bool => {default=>0}],
},
}
And here's a lil bonus that's lowkey a big deal: it's now possible to give summary and description to the schema as well as to the argument. Double the slay π
β¨
So accordingly, the result property is also now a hash, instead of a schema. Move the schema into the schema hash key. Same energy, different shape π§
π Sub::Spec::HTTP π
For the most part? You only need to upgrade your client and server library. That's it, that's the whole assignment π«Ά
- The client library is now
Perinci::CmdLineandPerinci::Access. - The server library is now
Perinci::Access::HTTP::Server.
The specification is now Riap and Riap::HTTP. Terminology changes abound, bestie:
- An SS request now becomes a Riap request.
- Some key names changed β specifically, they got shortened.
- Special headers are now prefixed with
X-Riap-*instead ofX-SS-Req-*. - Log levels are now numeric only (
1-6) instead of numeric/string. Pick a number, any number π’
π HOMEPAGE π
Please visit the project's homepage at <https://metacpan.org/release/Rinci>. Go say hi π
β SOURCE β
Source repository is at <https://github.com/perlancar/perl-Rinci>. Peek the code, it's giving main character energy π₯
π AUTHOR π
perlancar <perlancar@cpan.org> β the icon, the legend π
πΈ CONTRIBUTING πΈ
Wanna help out? Obsessed. Here's how: you can send patches by email/via RT, or send pull requests on GitHub. Pick your fighter π
Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:
% prove -l
If you do want to build the distribution (like, say, to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. Fr fr π
π¦ COPYRIGHT AND LICENSE π¦
This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>. That's a lot of years and honestly? Respect π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π BUGS π
Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Rinci>. Tell them everything π£οΈ
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. Help them help you, bestie π«Ά
And that's the whole page, babes β¨ This was Rinci::Upgrading(3pm) from perl v5.38.2, dated 2024-01-20 β go forth and upgrade your metadata, you absolute legend π
ππ
π¦ where this page comes from
- debian trixie: librinci-perl 1.1.104-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librinci-perl 1.1.104-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librinci-perl 1.1.104-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librinci-perl 1.1.104-1 Β· 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