Rinci-1.1.100/0000775000175000017500000000000014173151307010352 5ustar s1s1Rinci-1.1.100/META.json0000644000175000017500000005523214173151307012000 0ustar s1s1{ "abstract" : "Language-neutral metadata for your code", "author" : [ "perlancar " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.023, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Rinci", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" }, "x_spec" : { "DefHash" : "v2.0.0", "Sah" : "v0.9.50" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::More" : "0" } } }, "provides" : { "Rinci" : { "file" : "lib/Rinci.pm", "version" : "v1.1.100" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Rinci" }, "homepage" : "https://metacpan.org/release/Rinci", "repository" : { "type" : "git", "url" : "git://github.com/perlancar/perl-Rinci.git", "web" : "https://github.com/perlancar/perl-Rinci" } }, "version" : "1.1.100", "x_Dist_Zilla" : { "perl" : { "version" : "5.034000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease", "name" : "@Author::PERLANCAR/PERLANCAR::CheckPendingRelease", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "@Author::PERLANCAR/@Filter/GatherDir", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Author::PERLANCAR/@Filter/PruneCruft", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Author::PERLANCAR/@Filter/ManifestSkip", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Author::PERLANCAR/@Filter/MetaYAML", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Author::PERLANCAR/@Filter/License", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Author::PERLANCAR/@Filter/PodCoverageTests", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Author::PERLANCAR/@Filter/PodSyntaxTests", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Author::PERLANCAR/@Filter/ExtraTests", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::PERLANCAR/@Filter/ExecDir", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Author::PERLANCAR/@Filter/ShareDir", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Author::PERLANCAR/@Filter/MakeMaker", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Author::PERLANCAR/@Filter/Manifest", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Author::PERLANCAR/@Filter/ConfirmRelease", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::PERLANCAR/ExecDir script", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::BeforeBuild", "name" : "@Author::PERLANCAR/PERLANCAR::BeforeBuild", "version" : "0.606" }, { "class" : "Dist::Zilla::Plugin::Rinci::AbstractFromMeta", "name" : "@Author::PERLANCAR/Rinci::AbstractFromMeta", "version" : "0.10" }, { "class" : "Dist::Zilla::Plugin::PodnameFromFilename", "name" : "@Author::PERLANCAR/PodnameFromFilename", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec", "name" : "@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec", "version" : "0.062" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::MetaResources", "name" : "@Author::PERLANCAR/PERLANCAR::MetaResources", "version" : "0.043" }, { "class" : "Dist::Zilla::Plugin::CheckChangeLog", "name" : "@Author::PERLANCAR/CheckChangeLog", "version" : "0.05" }, { "class" : "Dist::Zilla::Plugin::CheckMetaResources", "name" : "@Author::PERLANCAR/CheckMetaResources", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@Author::PERLANCAR/CheckSelfDependency", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.17.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@Author::PERLANCAR/Git::Contributors", "version" : "0.036" }, { "class" : "Dist::Zilla::Plugin::CopyrightYearFromGit", "name" : "@Author::PERLANCAR/CopyrightYearFromGit", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::IfBuilt", "name" : "@Author::PERLANCAR/IfBuilt", "version" : "0.03" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Author::PERLANCAR/MetaJSON", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Author::PERLANCAR/MetaConfig", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.023" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@Author::PERLANCAR/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::Authority", "name" : "@Author::PERLANCAR/PERLANCAR::Authority", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::OurDate", "name" : "@Author::PERLANCAR/OurDate", "version" : "0.03" }, { "class" : "Dist::Zilla::Plugin::OurDist", "name" : "@Author::PERLANCAR/OurDist", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::OurPkgVersion", "name" : "@Author::PERLANCAR/OurPkgVersion", "version" : "0.21" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Author::PERLANCAR/Name", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Author::PERLANCAR/Version", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Author::PERLANCAR/prelude", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Author::PERLANCAR/Leftovers", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Author::PERLANCAR/postlude", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Completion::GetoptLongComplete", "name" : "@Author::PERLANCAR/Completion::GetoptLongComplete", "version" : "0.08" }, { "class" : "Pod::Weaver::Section::Completion::GetoptLongSubcommand", "name" : "@Author::PERLANCAR/Completion::GetoptLongSubcommand", "version" : "0.04" }, { "class" : "Pod::Weaver::Section::Completion::GetoptLongMore", "name" : "@Author::PERLANCAR/Completion::GetoptLongMore", "version" : "0.001" }, { "class" : "Pod::Weaver::Section::Homepage::DefaultCPAN", "name" : "@Author::PERLANCAR/Homepage::DefaultCPAN", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::Source::DefaultGitHub", "name" : "@Author::PERLANCAR/Source::DefaultGitHub", "version" : "0.07" }, { "class" : "Pod::Weaver::Section::Bugs::DefaultRT", "name" : "@Author::PERLANCAR/Bugs::DefaultRT", "version" : "0.06" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Author::PERLANCAR/Authors", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@Author::PERLANCAR/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::PERLANCAR::Contributing", "name" : "@Author::PERLANCAR/PERLANCAR/Contributing", "version" : "0.292" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Author::PERLANCAR/Legal", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::Rinci", "name" : "@Author::PERLANCAR/Rinci", "version" : "0.780" }, { "class" : "Pod::Weaver::Plugin::AppendPrepend", "name" : "@Author::PERLANCAR/AppendPrepend", "version" : "0.01" }, { "class" : "Pod::Weaver::Plugin::EnsureUniqueSections", "name" : "@Author::PERLANCAR/EnsureUniqueSections", "version" : "0.163250" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Author::PERLANCAR/SingleEncoding", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::PERLANCAR::SortSections", "name" : "@Author::PERLANCAR/PERLANCAR::SortSections", "version" : "0.082" } ] } }, "name" : "@Author::PERLANCAR/PodWeaver", "version" : "4.009" }, { "class" : "Dist::Zilla::Plugin::PruneFiles", "name" : "@Author::PERLANCAR/PruneFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::Pod2Readme", "name" : "@Author::PERLANCAR/Pod2Readme", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::Rinci::AddPrereqs", "name" : "@Author::PERLANCAR/Rinci::AddPrereqs", "version" : "0.145" }, { "class" : "Dist::Zilla::Plugin::Rinci::AddToDb", "name" : "@Author::PERLANCAR/Rinci::AddToDb", "version" : "0.020" }, { "class" : "Dist::Zilla::Plugin::Rinci::EmbedValidator", "name" : "@Author::PERLANCAR/Rinci::EmbedValidator", "version" : "0.251" }, { "class" : "Dist::Zilla::Plugin::SetScriptShebang", "name" : "@Author::PERLANCAR/SetScriptShebang", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "test", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@Author::PERLANCAR/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::Test::Perl::Critic::Subset", "config" : { "Dist::Zilla::Plugin::Test::Perl::Critic::Subset" : { "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ] } }, "name" : "@Author::PERLANCAR/Test::Perl::Critic::Subset", "version" : "3.001.006" }, { "class" : "Dist::Zilla::Plugin::Test::Rinci", "name" : "@Author::PERLANCAR/Test::Rinci", "version" : "0.040" }, { "class" : "Dist::Zilla::Plugin::StaticInstall", "config" : { "Dist::Zilla::Plugin::StaticInstall" : { "dry_run" : 0, "mode" : "on" } }, "name" : "@Author::PERLANCAR/StaticInstall", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest", "name" : "@Author::PERLANCAR/EnsureSQLSchemaVersionedTest", "version" : "0.03" }, { "class" : "Dist::Zilla::Plugin::Acme::CPANModules::Blacklist", "name" : "@Author::PERLANCAR/Acme::CPANModules::Blacklist", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::Prereqs::EnsureVersion", "name" : "@Author::PERLANCAR/Prereqs::EnsureVersion", "version" : "0.050" }, { "class" : "Dist::Zilla::Plugin::Prereqs::CheckCircular", "name" : "@Author::PERLANCAR/Prereqs::CheckCircular", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN::WWWPAUSESimple", "name" : "@Author::PERLANCAR/UploadToCPAN::WWWPAUSESimple", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "x_spec" } }, "name" : "DevelopX_spec", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.023" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.023" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.023" } }, "x_authority" : "cpan:PERLANCAR", "x_contributors" : [ "Steven Haryanto " ], "x_generated_by_perl" : "v5.34.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.26", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", "x_static_install" : 1 } Rinci-1.1.100/LICENSE0000644000175000017500000004420514173151307011362 0ustar s1s1This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Rinci-1.1.100/Changes0000644000175000017500000007062214173151307011652 0ustar s1s11.1.100 2022-01-23 Released-By: PERLANCAR; Urgency: medium; Backward-Incompatible: yes - [incompatible change] Rename 'title' result metadata property to 'caption'. - [removed] Remove deprecated specification Rinci::Undo. 1.1.99 2021-12-09 Released-By: PERLANCAR; Urgency: medium [Specification] - Introduce 'title' property in result metadata. [Others] - Sort POD headings, fix formatting. - Tweak Abstract of Rinci::FAQ. 1.1.98 2021-01-22 Released-By: PERLANCAR; Urgency: low - No spec changes. - Fix wording/formatting. 1.1.97 2021-01-22 Released-By: PERLANCAR; Urgency: low - No spec changes. - Edit Changes. 1.1.96 2021-01-22 Released-By: PERLANCAR; Urgency: medium - Introduce result metadata properties: content_type, location, func_content_type.*. - Introduce special function argument -content_type_ARGNAME. 1.1.95 2020-10-01 Released-By: PERLANCAR; Urgency: low - No spec changes. - POD formatting tweak so 'Enveloped result' heading can be referred with a POD link. 1.1.94 2020-09-23 Released-By: PERLANCAR; Urgency: medium - Introduce function example's env_result and naked_result properties. 1.1.93 2019-07-19 Released-By: PERLANCAR; Urgency: low - No spec changes. - [pod] Fix link to Sah's 'examples' clause. 1.1.92 2019-07-19 Released-By: PERLANCAR; Urgency: low - No spec changes. - Expand on function argument's 'examples' property, and mention Sah's 'examples' clause. 1.1.91 2019-05-25 Released-By: PERLANCAR - Declare the priority of result schema from result metadata to be *lower* than schema from function metadata's result property. 1.1.90 2019-05-24 Released-By: PERLANCAR - Introduce result metadata property: schema. 1.1.89 2019-04-15 Released-By: PERLANCAR - No spec changes. - Replace greedy with slurpy in examples. 1.1.88 2019-04-15 Released-By: PERLANCAR - Introduce argument property 'slurpy' as replacement for 'greedy', note that 'greedy' will be removed in Rinci 1.2. 1.1.87 2018-11-29 Released-By: PERLANCAR - Specify function argument 'examples'. 1.1.86 2017-12-09 Released-By: PERLANCAR - [Incompatible change] Revert 1.1.85's change: "Specify that example's result must always be in enveloped form, to remove ambiguity and to have the ability to specify status." 1.1.85 2017-10-26 Released-By: PERLANCAR - Specify that example's result must always be in enveloped form, to remove ambiguity and to have the ability to specify status. [UPDATE 2017-12-09: reverted in 1.1.86]. 1.1.84 2016-12-28 Released-By: PERLANCAR - No spec changes. - [dist] Remove spec prereq to Sah::Schemas since Sah::Schema::rinci::* have been split to Sah-Schemas-Rinci. - [dist] Fix expressing spec prereq relationship with x_spec. 1.1.83 2016-12-15 Released-By: PERLANCAR - Specify that dry_run feature can also be a hash, to be able to set default dry_run mode. 1.1.82 2016-12-10 Released-By: PERLANCAR - Introduce argument spec property 'index_completion'. - Typo [RT#118381]. 1.1.81 2016-07-28 Released-By: PERLANCAR - No spec changes. - Split Sah schemas to Sah-Schemas-Rinci so that schema tweaks don't require releasing a new spec release. 1.1.80 2016-05-10 Released-By: PERLANCAR - No spec changes. - [Incompatible change] Follow Sah::Schemas spec (each individual schema is put in a separate Sah::Schema::* package). Sah::Schema::Rinci is now replaced with Sah::Schema::rinci::* packages. 1.1.79 2016-02-25 Released-By: PERLANCAR - Define new command-line source for function argument (cmdline_src): stdin_or_args. 1.1.78 2015-09-03 Released-By: PERLANCAR - No spec changes. - [dist] Move spec prereqs from RuntimeRequires to DevelopRecommends to reduce deps but still allow indicating spec requirement. 1.1.77 2015-05-01 Released-By: PERLANCAR - No spec changes. - Typos (args_rels, not args_schema) & wording. 1.1.76 2015-04-30 Released-By: PERLANCAR - Replace function property 'args_groups' with 'args_rels'. This allows us to reuse the Sah 0.9.34+ specification, since the hash type now also contains clauses that specifies relationships between keys (arguments), e.g. choose_one, choose_all, req_one, req_all, dep_one, dep_all, req_dep_one, req_dep_all. 1.1.75 2015-03-28 Released-By: PERLANCAR - Add (experimental) argument specification: filters. 1.1.74 2015-03-18 Released-By: PERLANCAR - [Incompatible change] Use DefHash's 'caption' property for link title, instead of using another ('title'). - Introduce another value for 'cmdline_src' argument spec property: 'stdin_or_file' (in addition to 'stdin_or_files'). 1.1.73 2015-02-07 Released-By: PERLANCAR - No spec changes. - Forgot to update schema. 1.1.72 2015-02-07 Released-By: PERLANCAR - Introduce function property 'args_groups' to allow things like requiring {only one,all} members of a group of args must be specified (and possibly others in the future). UPDATE: Now replaced with 'args_rels'. - Specify argument specification property 'deps', to allow an argument to depend on others. 1.1.71 2015-01-17 Released-By: PERLANCAR - Specify that streaming input and output now uses coderef instead of filehandle/etc. This is simpler and has the side-effects of easier to do wrapping for (see Perinci::Sub::Wrapper) where one can just wrap the coderef to do per-record validation of streaming input/output. 1.1.70 2014-11-19 Released-By: PERLANCAR - Add 'links' property to arg spec. 1.1.69 2014-10-30 Released-By: PERLANCAR - No spec changes. - [Bugfix] forgot to update Sah schema. 1.1.68 2014-10-30 Released-By: PERLANCAR - Forgot to mention 'stream' argument spec property. 1.1.67 2014-10-30 Released-By: PERLANCAR [INCOMPATIBLE CHANGES] - Tweaks/changes to sending of partial argument value: feature 'partial_arg' is removed as it is redundant (argument property 'partial' already hints this capability). When sending partial value, aside from '-arg_part_start' and '-arg_part_len', client now must also send '-arg_len' which is the total size. This is to follow more closely with HTTP Content-Range semantic. - Tweaks/changes to returning partial result: feature 'partial_res' is removed, function can now instead hint using the 'partial' property in its 'result' property. Result metadata properties 'res_part_start' and 'res_part_len' are now renamed to 'part_start' and 'part_len'. 'len' is now also added to return information on total size (to follow HTTP Content-Range semantic more closely). [ENHANCEMENTS] - Introduce argument property 'stream' to signify accepting input stream. Input stream (like stdin) is a basic feature in most programming environment so it should be supported. Implementation of command-line framework will provide a filehandle for the argument, where the function can read data from. - Introduce result metadata property 'stream' to signify output is a stream. Output stream (like stdout) is a basic feature in most programming environment so it should be supported. This feature is actually already in Unixish for some time. 1.1.66 2014-10-29 Released-By: PERLANCAR - Currently limit that there should at most be one argument with partial=1. The special arguments become just '-arg_part_start' and '-arg_part_len'. 1.1.65 2014-10-29 Released-By: PERLANCAR - No spec changes. - [Bugfix] Forgot to update Sah schema. 1.1.64 2014-10-29 Released-By: PERLANCAR [ENHANCEMENTS] - Introduce sending partial arguments and returning partial result, similar in spirit to Ranges in HTTP/1.1. New argument specification properties: 'partial'. New features: 'partial_arg', 'partial_res'. New special arguments: '-arg_part_start', '-arg_part_len', '-res_part_start', '-res_part_len'. New result metadata properties: 'res_part_start', 'res_part_len'. UPDATE in 1.1.67: 'partial_res' is removed, '-res_part_start' & '-res_part_len' renamed to 'part_start & part_len'. 1.1.63 2014-10-28 Released-By: PERLANCAR [ENHANCEMENTS] - Introduce statuses 201, 204. [INCOMPATIBLE CHANGES] - Introduce status 207. Replace result metadata properties 'arg_errors' & 'arg_warnings' with the more generic 'results' to report per-item/detailed statuses. 1.1.62 2014-10-23 Released-By: PERLANCAR [REMOVED FEATURES] - Cancel support for 'encoding' (in result metadata as well in argument specification and result specification). This is an issue with JSON which cannot handle binary data and should be handled in the Riap level, not Rinci. Note: to mark a function argument or result as containing binary data, use the schema type 'buf'. 1.1.61 2014-10-22 Released-By: PERLANCAR - Introduce 'encoding' property in result specification, to give hints to tools that function wants to encode its result by default. Said tool can encode the result and set the 'encoding' property in the result metadata. UPDATE in 1.1.62: removed. 1.1.60 2014-10-22 Released-By: PERLANCAR - No spec changes. - Forgot to update Sah schemas. 1.1.59 2014-10-22 Released-By: PERLANCAR - Update to DefHash 1.0.6 (introduced 'caption' property, which actually doesn't affect us much). - Introduce 'encoding' property in result metadata and argument specification. Currently the only known encoding is 'base64'. This is for functions that want to accept/return binary data, when transport protocol (e.g. 'json' format in Riap) does not support binary data (one can also use binary-safe formats in Riap e.g. Storable or Sereal, but this is not widely supported across languages like JSON). Tools can be written to support automatic decoding of function arguments and automatic encoding of function result. In Perl, see CPAN module Perinci::Sub::Wrapper. UPDATE in 1.1.62: removed. - Introduce 'arg_errors' and 'arg_warnings' properties in result metadata. This is for functions that do form processing, because often we want to send the error message for all non-validating arguments (form fields) instead of just the first one found. In Perl, see CPAN module Borang. UPDATE in 1.1.63: replaced with 'results'. - Introduce '-action' special argument and the 'check_arg' feature. The '-action' can toggle special invocation modes to the function. This is like '-tx_action' except is not necessarily related to transactions. Currently the only known action is 'check_arg', to check a single argument. This is for functions that do form processing, e.g. when user is editing a form field on the browser and we do AJAX calls to do validation as user types. 1.1.58 2014-10-16 Released-By: PERLANCAR - No functional changes. - Rename Rinci::result -> Rinci::resmeta. 1.1.57 2014-10-11 Released-By: PERLANCAR - Introduce is_flag bool property on command-line alias. This is just a convenience so you don't have to write: schema => [bool => {is=>1}]. 1.1.56 2014-10-10 Released-By: PERLANCAR - Introduce argument element submetadata (element_meta property in argument specification, experimental). This is to support forms. 1.1.55 2014-10-09 Released-By: PERLANCAR - Introduce argument submetadata (experimental). This is to support forms where one submits form (including subforms) to a function. 1.1.54 2014-09-12 Released-By: PERLANCAR - Add result metadata property: perm_err. - Add FAQ and other POD tweaks. 1.1.53 2014-09-11 Released-By: PERLANCAR - Introduce function argument spec properties: cmdline_prompt, is_password. This is to enable CLI programs to prompt password interactively. 1.1.52 2014-06-29 Released-By: SHARYANTO - Allow completion routine to return hash (completion reply + metadata) instead of just array (completion reply), as already implemented in Perinci::Sub::Complete and Complete::Util. This allows giving hints on how to escape completion entries (which might be different depending on the type of completion, e.g. files vs environment variables where we don't want to escape '$', and so on). 1.1.51 2014-06-25 Released-By: SHARYANTO - No spec changes. - Tweak/fix Sah schema. 1.1.50 2014-06-13 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - Revert previous change (args/as -> args_as; args/as conflicts with actual arguments!). Revert result/is_naked -> result_naked too, not worth the trouble of breaking every function out there. What was steven-- thinking? 1.1.49 2014-06-13 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - Rename args_as to args/as, result_naked to result/is_naked to make top-level properties cleaner. Implementation should still support the old properties for a while. UPDATE in 1.1.50: renamed back. [BUG FIXES] - Checking dep func/pkg should be done using Riap info action and not meta. 1.1.48 2014-05-28 Released-By: SHARYANTO - function: Specify two new function dependency: pkg & func. 1.1.47 2014-05-01 Released-By: SHARYANTO - No spec changes. - Tweak/fix schema. 1.1.46 2014-04-30 Released-By: SHARYANTO - No spec changes. - Tweak/fix schema. 1.1.45 2014-04-28 Released-By: SHARYANTO - No spec changes. - Tweak schema. 1.1.44 2014-04-27 Released-By: SHARYANTO - Add Sah::Schema::Rinci (replaces Rinci::Schema). [REMOVED FEATURES] - function: Remove argument spec's 'cmdline_on_getarg' (for now?) because the current implementation does not allow calling the hook on a per-encountered basis (the argv is remainder from Getopt::Long after all the options have been processed). 1.1.43 2013-12-25 Released-By: SHARYANTO; Note: Ho ho ho! - function: Add argument spec's 'cmdline_on_getopt' and 'cmdline_on_getarg'. UPDATE in 1.1.44: 'cmdline_on_getarg' removed. 1.1.42 2013-11-14 Released-By: SHARYANTO - function: Add argument spec's 'delete' and 'element_completion' properties. 1.1.41 2013-11-08 Released-By: SHARYANTO - function: Introduce value 'file' for argument spec property 'cmdline_src', to allow function to get file content in its argument. - function: Introduce property 'test' on example spec, to allow test module to skip testing a certain examples. 1.1.40 2013-10-28 Released-By: SHARYANTO - result: Add properties 'func.*'. 1.1.39 2013-10-15 Released-By: SHARYANTO; Note: with the smell of burning goat meat in the house! - function: examples: Introduce 'src' and 'src_plang' so that more general examples can be specified. - function: cmdline_aliases: 'code' now gets (\%args, $val) instead of just (\%args). 1.1.38 2013-09-15 Released-By: SHARYANTO - result: Add property 'logs'. 1.1.37 2013-09-13 Released-By: SHARYANTO - result: Replace property 'error_stack' with 'prev'. 1.1.36 2013-09-07 Released-By: SHARYANTO - Rename property 'entity_version' to 'entity_v' to be more consistent with DefHash ('defhash_v'). 1.1.35 2013-04-11 Released-By: SHARYANTO - Introduce property 'x' (from DefHash 1.0.3). 1.1.34 2012-11-07 Released-By: SHARYANTO - function: Introduce status 44x and 54x (experimental). 1.1.33 2012-11-07 Released-By: SHARYANTO - No spec changes. (Temporarily?) split Rinci::Schema to its own dist so I can release them often separately. UPDATE in 1.1.44: Rinci::Schema replaced with Sah::Schema::Rinci. 1.1.32 2012-11-01 Released-By: SHARYANTO - result: Add property 'error_stack'. - function: property 'result': Add key 'statuses'. 1.1.31 2012-09-19 Released-By: SHARYANTO - Base specification on DefHash. - Remove 'text_markup' property. Will depend on DefHash for this. 1.1.30 2012-09-07 Released-By: SHARYANTO - No spec changes. Rename back a file (Rinci/Schema.pm) that I thought was not used (me--). [CT] 1.1.29 2012-09-04 Released-By: SHARYANTO - Transaction: In 'check_state' phase, specify that result message should contain a description of what needs to be fixed, or how it is already fixed, or how it is unfixable; the message can then be logged by TM to be displayed to user. 1.1.28 2012-08-29 Released-By: SHARYANTO [INCOMPATIBLE CHANGE] - Transaction: To link between 'check_state' call and 'fix_state' call (e.g. function want to preserve some value between call), previously in 'fix_state' call TM passes '-tx_undo_actions' containing the undo actions from the 'check_state'. Now a simpler way is introduced to replace this: '-tx_action_id' containing a unique UUID (in 32-character hexdigit). BTW, '-tx_undo_actions' has not been implemented in Perinci::Tx::Manager, so the next release of Perinci::Tx::Manager will just implement '-tx_action_id'. 1.1.27 2012-08-28 Released-By: SHARYANTO - Introduce status code 331. - Mark which status codes are in HTTP spec, which are introduced by us. 1.1.26 2012-08-22 Released-By: SHARYANTO - Term change: call -> action. 1.1.25 2012-08-22 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - Remove properties 'use' and 'req' in 'tx' feature. This is to make things simpler. use=>1 is redundant, if function follows transaction protocol it means you can use it in transaction. req=>1 is also removed, all functions should just require transaction and potentially return 'do_actions'. A simple wrapper can be created to execute those actions without transaction, if wanted. 1.1.24 2012-08-21 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - Deprecate undo protocol, now undo should be implemented solely using transaction. - Revise transaction specification. Introduce protocol version (v) and bump it to v=2. Require 'tx' feature to specify protocol version. Incompatibilities include: 1) transaction now no longer uses undo protocol but adapts mechanism from Perinci::Sub::Gen::Undoable (which will also be deprecated as the mechanism is now elevated into standards); 2) TM object no longer needs to be passed to function, this should be safer; function now detects transaction using '-tx_action' special argument. [ENHANCEMENTS] - Specify TM's interface in more details (moved from Riap::Transaction, which now becomes shorter). - Specify steps for action, rollback, and crash recovery in more details, with example. 1.1.23 2012-08-14 Released-By: SHARYANTO - Major rewrite of transaction specification. The main motivation is to remove the concept of 'steps' as this is a false dichotomy. Steps are actually functions themselves, the units of work are still functions. Eventually, a complex system will need to nest functions inside functions, to more than two levels of nesting. Why divide and limit into two levels (function-step)? So: - Everything is a bit clearer now - $tm interface is saner ($tm->call, easier to call function inside another) - No more mention of unused transaction status: e - New transaction statuses: v (rollback of undoing process), e (rollback of redoing process). - Recovery does not always mean rollback (to R). For transactions in u and d status, we continue the undoing/redoing. For transactions in v and e status, we continue the rollback to final status C and U, respectively. 1.1.22 2012-08-09 Released-By: SHARYANTO - tx: Describe the ordering of calls during undo/rollback/redo when there is nested call. The same function may be called twice or more with parts of undo/redo steps. - tx: In transaction mode, function now gets undo/redo data from the usual -undo_data special argument, like in non-transaction mode. Txm's API get_undo_steps() and get_redo_steps() are now removed. 1.1.21 2012-07-23 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - function: Remove argument specification key 'src', use 'cmdline_src' instead. I think 'src' is too general. 1.1.20 2012-07-21 Released-By: SHARYANTO - function: Add argument specification keys 'src' and 'cmdline_src'. UPDATE in 1.1.21: 'src' removed. 1.1.19 2012-06-22 Released-By: SHARYANTO - Adjust transaction status labels. Final statuses are now in uppercase: C, R, U, X; while transient statuses are in lowercase: i, a, u, d, e. - Add response status 429 (too many requests). 1.1.18 2012-06-06 Released-By: SHARYANTO - Refinements to transaction details. - Remove dependency clause 'undo_storage'. Add dependency clauses 'tmp_dir', 'trash_dir', 'undo_trash_dir'. 1.1.17 2012-05-31 Released-By: SHARYANTO - Specify transactional system (Rinci::function::Transaction). Split specification for undo to Rinci::function::Undo and specify undo/redo protocol under transaction. UPDATE in 1.1.24: Undo protocol deprecated. 1.1.16 2012-05-03 Released-By: SHARYANTO - Refine undo protocol documentation. Specify interaction with undo/transaction manager. '-undo_hint' is now replaced by '-undo_storage'. Declare 'undo_storage' dependency clause. UPDATE in 1.1.24: Undo protocol deprecated in favor of transaction. 1.1.15 2012-05-02 Released-By: SHARYANTO - No spec changes. [INCOMPATIBLE CHANGE] - Update Sah schema syntax (pre-0.03, [merge:X] -> [mergeX]) 1.1.14 2012-05-02 Released-By: SHARYANTO [INCOMPATIBLE CHANGE] - Change 'exec' dependency clause to 'prog' (avoid possible confusion because 'exec' can imply that we need to execute the program; there can be other future dep clause for that). 1.1.13 2012-03-23 Released-By: SHARYANTO [ENHANCEMENTS] - Each tag in 'tags' property can also be a tag metadata hash (for translatable message, etc). 1.1.12 2012-03-13 Released-By: SHARYANTO [ENHANCEMENTS] - Add 'Rinci::result'. 1.1.11 2012-03-13 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - package: Remove property 'pkg_version' (use 'entity_version' instead). [ENHANCEMENTS] - Add property 'entity_version'. UPDATE in 1.1.36: renamed to 'entity_v'. 1.1.10 2012-02-28 Released-By: SHARYANTO - function: arg spec 'aliases': Add alias spec 'schema' 1.1.9 2012-02-28 Released-By: SHARYANTO [INCOMPATIBLE CHANGE] - function: Change (back) 'set' alias spec to 'code', in arg spec 'aliases' (for backward compatibility with 1.0) 1.1.8 2012-02-28 Released-By: SHARYANTO [INCOMPATIBLE CHANGES] - function: Replace (back) 'alias_for' argument spec with 'cmdline_aliases'. I first used 'alias_for' so I can list each alias as a key in 'args' property. The goal is so I can get all argument names (- aliases) simply by doing a keys() on 'args' hash. And the goal of that is to add a 'complete_arg_name' Riap action which is more lightweight than a full 'meta' just to get argument names. Turns out that I don't need 'alias_for' just to support 'complete_arg_name', and also turns out that completing argument name needs more than just all argument names - aliases. You also need 'pos' information. So a full 'meta' is currently used. The reason I now revert to 'cmdline_aliases' style is because I don't want command-line aliases to become full/first-class argument. 1.1.7 2012-02-23 Released-By: SHARYANTO - package: Add property 'pkg_version'. UPDATE in 1.1.11 & 1.1.36: replaced by 'entity_v'. 1.1.6 2012-02-21 Released-By: SHARYANTO - function: Add 'alias_for' argument specification. UPDATE 1.1.8: removed. 1.1.5 2012-02-10 Released-By: SHARYANTO - No spec changes. - Add Rinci::Schema. 1.1.4 2012-02-01 Released-By: SHARYANTO - Declare that 1.1 series might introduce minor backward compatibility problems between revisions. - Rename 'arg_pass_style' and 'result_envelope' to the old (Sub::Spec-era) 'args_as' and 'result_naked'. New names are not better. - Code entity URI now moved to Riap specification as the 'riap' URI scheme. - Some minor revisions. 1.1.3 2012-01-27 Released-By: SHARYANTO - Change syntax of code entity URI, from 'Pkg.SubPkg.func' to 'pm:/Pkg/SubPkg/func' (or 'py:', 'php:', and so on). - Some minor revisions like wording and paragraph reorganization. 1.1.2 2012-01-19 Released-By: SHARYANTO - Add 'default_lang' property. Add guidelines on what to put in 'summary' and 'description'. - variable: Add 'schema' property. 1.1.1 2012-01-18 Released-By: SHARYANTO - No spec changes. Update module names (Rinci::HTTP -> Riap, Rias -> Perinci). Add documents Rinci::Upgrading and Rinci::Tutorial (stub). 1.1.0 2012-01-15 Released-By: SHARYANTO - First release. Spun off from Sub::Spec. [INCOMPATIBLE CHANGES FROM Sub::Spec 1.0.x] - Terminology: 'spec clause' becomes 'property'. This is to avoid confusion with 'clause' as used in Sah schema language. - Default text markup format changed from Org to Markdown, but a new properties 'text_markup' is added to allow specifying 'org' or 'markdown' (or 'none'). UPDATE in 1.1.31: 'text_markup' property removed. - 'v' clause is now required to declare Rinci spec version (with value 1.1, if unspecified then assumed spec is old Sub::Spec 1.0). - function: Incompatible changes to 'args' and 'result' properties; 'args' is now a hash of arg names and arg *specs* (instead of arg schemas). 'result' is now a hash of data, instead of schema. The purpose is to keep Sah schema clean from custom, non-schema-related schema clauses, like arg_* (thus requiring custom Sah extensions, etc). Mixing them into schemas was not the right way. - function: property 'type' removed, replaced with 'is_func', 'is_meth', 'is_static_meth'. This is because a single subroutine/function can act as all. - function: Other properties which are also removed/replaced: 'timeout' (non-core), 'retry' (non-core), 'scope' (can be replaced by using tags), 'result_naked' (replaced by 'result_envelope'), 'args_as' (replaced by 'arg_pass_style'). UPDATE in 1.1.4: 'arg_pass_style' renamed back to 'args_as', 'result_envelope' renamed back to 'result_naked' because the new names are not deemed as better. - function: property 'deps': terminology change ('dep clause' -> 'dep type'), rename dep types: 'sub' -> 'func', 'mod' -> 'perl_module'. [NEW FEATURES FROM Sub::Spec 1.0.x] - Keys beginning with "_" are allowed and ignored. This can be used to store extra information. - New properties: 'tags', 'links', 'examples'. Rinci-1.1.100/META.yml0000644000175000017500000003624214173151307011630 0ustar s1s1--- abstract: 'Language-neutral metadata for your code' author: - 'perlancar ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Test::More: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.023, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Rinci provides: Rinci: file: lib/Rinci.pm version: v1.1.100 resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Rinci homepage: https://metacpan.org/release/Rinci repository: git://github.com/perlancar/perl-Rinci.git version: 1.1.100 x_Dist_Zilla: perl: version: '5.034000' plugins: - class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease' version: '0.001' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . name: '@Author::PERLANCAR/@Filter/GatherDir' version: '6.023' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::PERLANCAR/@Filter/PruneCruft' version: '6.023' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Author::PERLANCAR/@Filter/ManifestSkip' version: '6.023' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::PERLANCAR/@Filter/MetaYAML' version: '6.023' - class: Dist::Zilla::Plugin::License name: '@Author::PERLANCAR/@Filter/License' version: '6.023' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Author::PERLANCAR/@Filter/PodCoverageTests' version: '6.023' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Author::PERLANCAR/@Filter/PodSyntaxTests' version: '6.023' - class: Dist::Zilla::Plugin::ExtraTests name: '@Author::PERLANCAR/@Filter/ExtraTests' version: '6.023' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::PERLANCAR/@Filter/ExecDir' version: '6.023' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::PERLANCAR/@Filter/ShareDir' version: '6.023' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Author::PERLANCAR/@Filter/MakeMaker' version: '6.023' - class: Dist::Zilla::Plugin::Manifest name: '@Author::PERLANCAR/@Filter/Manifest' version: '6.023' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::PERLANCAR/@Filter/ConfirmRelease' version: '6.023' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::PERLANCAR/ExecDir script' version: '6.023' - class: Dist::Zilla::Plugin::PERLANCAR::BeforeBuild name: '@Author::PERLANCAR/PERLANCAR::BeforeBuild' version: '0.606' - class: Dist::Zilla::Plugin::Rinci::AbstractFromMeta name: '@Author::PERLANCAR/Rinci::AbstractFromMeta' version: '0.10' - class: Dist::Zilla::Plugin::PodnameFromFilename name: '@Author::PERLANCAR/PodnameFromFilename' version: '0.02' - class: Dist::Zilla::Plugin::PERLANCAR::EnsurePrereqToSpec name: '@Author::PERLANCAR/PERLANCAR::EnsurePrereqToSpec' version: '0.062' - class: Dist::Zilla::Plugin::PERLANCAR::MetaResources name: '@Author::PERLANCAR/PERLANCAR::MetaResources' version: '0.043' - class: Dist::Zilla::Plugin::CheckChangeLog name: '@Author::PERLANCAR/CheckChangeLog' version: '0.05' - class: Dist::Zilla::Plugin::CheckMetaResources name: '@Author::PERLANCAR/CheckMetaResources' version: '0.001' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@Author::PERLANCAR/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.17.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@Author::PERLANCAR/Git::Contributors' version: '0.036' - class: Dist::Zilla::Plugin::CopyrightYearFromGit name: '@Author::PERLANCAR/CopyrightYearFromGit' version: '0.009' - class: Dist::Zilla::Plugin::IfBuilt name: '@Author::PERLANCAR/IfBuilt' version: '0.03' - class: Dist::Zilla::Plugin::MetaJSON name: '@Author::PERLANCAR/MetaJSON' version: '6.023' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::PERLANCAR/MetaConfig' version: '6.023' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.023' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@Author::PERLANCAR/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::PERLANCAR::Authority name: '@Author::PERLANCAR/PERLANCAR::Authority' version: '0.001' - class: Dist::Zilla::Plugin::OurDate name: '@Author::PERLANCAR/OurDate' version: '0.03' - class: Dist::Zilla::Plugin::OurDist name: '@Author::PERLANCAR/OurDist' version: '0.02' - class: Dist::Zilla::Plugin::OurPkgVersion name: '@Author::PERLANCAR/OurPkgVersion' version: '0.21' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.018' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.018' - class: Pod::Weaver::Section::Name name: '@Author::PERLANCAR/Name' version: '4.018' - class: Pod::Weaver::Section::Version name: '@Author::PERLANCAR/Version' version: '4.018' - class: Pod::Weaver::Section::Region name: '@Author::PERLANCAR/prelude' version: '4.018' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.018' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.018' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.018' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.018' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.018' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.018' - class: Pod::Weaver::Section::Leftovers name: '@Author::PERLANCAR/Leftovers' version: '4.018' - class: Pod::Weaver::Section::Region name: '@Author::PERLANCAR/postlude' version: '4.018' - class: Pod::Weaver::Section::Completion::GetoptLongComplete name: '@Author::PERLANCAR/Completion::GetoptLongComplete' version: '0.08' - class: Pod::Weaver::Section::Completion::GetoptLongSubcommand name: '@Author::PERLANCAR/Completion::GetoptLongSubcommand' version: '0.04' - class: Pod::Weaver::Section::Completion::GetoptLongMore name: '@Author::PERLANCAR/Completion::GetoptLongMore' version: '0.001' - class: Pod::Weaver::Section::Homepage::DefaultCPAN name: '@Author::PERLANCAR/Homepage::DefaultCPAN' version: '0.05' - class: Pod::Weaver::Section::Source::DefaultGitHub name: '@Author::PERLANCAR/Source::DefaultGitHub' version: '0.07' - class: Pod::Weaver::Section::Bugs::DefaultRT name: '@Author::PERLANCAR/Bugs::DefaultRT' version: '0.06' - class: Pod::Weaver::Section::Authors name: '@Author::PERLANCAR/Authors' version: '4.018' - class: Pod::Weaver::Section::Contributors name: '@Author::PERLANCAR/Contributors' version: '0.009' - class: Pod::Weaver::Section::PERLANCAR::Contributing name: '@Author::PERLANCAR/PERLANCAR/Contributing' version: '0.292' - class: Pod::Weaver::Section::Legal name: '@Author::PERLANCAR/Legal' version: '4.018' - class: Pod::Weaver::Plugin::Rinci name: '@Author::PERLANCAR/Rinci' version: '0.780' - class: Pod::Weaver::Plugin::AppendPrepend name: '@Author::PERLANCAR/AppendPrepend' version: '0.01' - class: Pod::Weaver::Plugin::EnsureUniqueSections name: '@Author::PERLANCAR/EnsureUniqueSections' version: '0.163250' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Author::PERLANCAR/SingleEncoding' version: '4.018' - class: Pod::Weaver::Plugin::PERLANCAR::SortSections name: '@Author::PERLANCAR/PERLANCAR::SortSections' version: '0.082' name: '@Author::PERLANCAR/PodWeaver' version: '4.009' - class: Dist::Zilla::Plugin::PruneFiles name: '@Author::PERLANCAR/PruneFiles' version: '6.023' - class: Dist::Zilla::Plugin::Pod2Readme name: '@Author::PERLANCAR/Pod2Readme' version: '0.004' - class: Dist::Zilla::Plugin::Rinci::AddPrereqs name: '@Author::PERLANCAR/Rinci::AddPrereqs' version: '0.145' - class: Dist::Zilla::Plugin::Rinci::AddToDb name: '@Author::PERLANCAR/Rinci::AddToDb' version: '0.020' - class: Dist::Zilla::Plugin::Rinci::EmbedValidator name: '@Author::PERLANCAR/Rinci::EmbedValidator' version: '0.251' - class: Dist::Zilla::Plugin::SetScriptShebang name: '@Author::PERLANCAR/SetScriptShebang' version: '0.01' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: test script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@Author::PERLANCAR/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::Test::Perl::Critic::Subset config: Dist::Zilla::Plugin::Test::Perl::Critic::Subset: finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' name: '@Author::PERLANCAR/Test::Perl::Critic::Subset' version: 3.001.006 - class: Dist::Zilla::Plugin::Test::Rinci name: '@Author::PERLANCAR/Test::Rinci' version: '0.040' - class: Dist::Zilla::Plugin::StaticInstall config: Dist::Zilla::Plugin::StaticInstall: dry_run: 0 mode: on name: '@Author::PERLANCAR/StaticInstall' version: '0.012' - class: Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest name: '@Author::PERLANCAR/EnsureSQLSchemaVersionedTest' version: '0.03' - class: Dist::Zilla::Plugin::Acme::CPANModules::Blacklist name: '@Author::PERLANCAR/Acme::CPANModules::Blacklist' version: '0.001' - class: Dist::Zilla::Plugin::Prereqs::EnsureVersion name: '@Author::PERLANCAR/Prereqs::EnsureVersion' version: '0.050' - class: Dist::Zilla::Plugin::Prereqs::CheckCircular name: '@Author::PERLANCAR/Prereqs::CheckCircular' version: '0.007' - class: Dist::Zilla::Plugin::UploadToCPAN::WWWPAUSESimple name: '@Author::PERLANCAR/UploadToCPAN::WWWPAUSESimple' version: '0.04' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: '6.023' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: x_spec name: DevelopX_spec version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.023' - class: Dist::Zilla::Plugin::FinderCode name: '@Author::PERLANCAR/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.023' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.023' x_authority: cpan:PERLANCAR x_contributors: - 'Steven Haryanto ' x_generated_by_perl: v5.34.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' x_static_install: 1 Rinci-1.1.100/Makefile.PL0000644000175000017500000000205514173151307012324 0ustar s1s1# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.023. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Language-neutral metadata for your code", "AUTHOR" => "perlancar ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Rinci", "LICENSE" => "perl", "NAME" => "Rinci", "PREREQ_PM" => {}, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0 }, "VERSION" => "1.1.100", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Rinci-1.1.100/t/0000775000175000017500000000000014173151307010615 5ustar s1s1Rinci-1.1.100/t/author-pod-coverage.t0000644000175000017500000000053614173151307014657 0ustar s1s1#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Rinci-1.1.100/t/author-critic.t0000644000175000017500000000120614173151307013554 0ustar s1s1#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006 use Test::Perl::Critic (-profile => "") x!! -e ""; my $filenames = ['lib/Rinci.pm','lib/Rinci.pod','lib/Rinci/FAQ.pod','lib/Rinci/Transaction.pod','lib/Rinci/Upgrading.pod','lib/Rinci/function.pod','lib/Rinci/package.pod','lib/Rinci/resmeta.pod','lib/Rinci/variable.pod']; unless ($filenames && @$filenames) { $filenames = -d "blib" ? ["blib"] : ["lib"]; } all_critic_ok(@$filenames); Rinci-1.1.100/t/author-pod-syntax.t0000644000175000017500000000045414173151307014411 0ustar s1s1#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Rinci-1.1.100/t/00-compile.t0000644000175000017500000000262614173151307012653 0ustar s1s1use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Rinci.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; Rinci-1.1.100/README0000644000175000017500000000317114173151307011232 0ustar s1s1NAME Rinci - Language-neutral metadata for your code VERSION This document describes version 1.1.100 of Rinci (from Perl distribution Rinci), released on 2022-01-23. HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . AUTHOR perlancar CONTRIBUTOR Steven Haryanto CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. 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 want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . 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 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. Rinci-1.1.100/dist.ini0000644000175000017500000000053014173151307012012 0ustar s1s1;--------------------------------- author = perlancar copyright_holder = perlancar license = Perl_5 ;--------------------------------- version=1.1.100 name=Rinci [@Author::PERLANCAR] :version=0.606 [Prereqs] [Prereqs / DevelopX_spec] -phase=develop -relationship=x_spec DefHash=2.0.0 Sah=0.9.50 Rinci-1.1.100/lib/0000775000175000017500000000000014173151307011120 5ustar s1s1Rinci-1.1.100/lib/Rinci/0000775000175000017500000000000014173151307012164 5ustar s1s1Rinci-1.1.100/lib/Rinci/variable.pod0000644000175000017500000000467514173151307014467 0ustar s1s1package Rinci::variable; # just to make PodWeaver happy # AUTHORITY # DATE our $DIST = 'Rinci'; # DIST # VERSION 1; # ABSTRACT: Metadata for your variables __END__ =pod =encoding UTF-8 =head1 NAME Rinci::variable - Metadata for your variables =head1 SPECIFICATION VERSION 1.1 =head1 VERSION This document describes version 1.1.100 of Rinci::variable (from Perl distribution Rinci), released on 2022-01-23. =head1 INTRODUCTION This document describes metadata for variables. This specification is part of L. Please do a read up on it first, if you have not already done so. =head1 SPECIFICATION There is currently no metadata properties specific to variables. =head2 Property: schema => SCHEMA Specify the Sah schema that the variable's value must validate to. This can be used by a variable wrapper (getter/setter generator) tool to make sure that variable always contains valid values. Example: # metadata for variable $Meaning_Of_Life { ... summary => 'The meaning of life', schema => [int => {between => [1, 100]}, } =head1 FAQ =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 SEE ALSO L =head1 AUTHOR perlancar =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. 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 want to build the distribution (e.g. to try to install it locally on your system), you can install L, L, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =cut Rinci-1.1.100/lib/Rinci/package.pod0000644000175000017500000000440714173151307014266 0ustar s1s1package Rinci::package; # just to make PodWeaver happy # AUTHORITY # DATE our $DIST = 'Rinci'; # DIST # VERSION 1; # ABSTRACT: Metadata for your namespaces/packages __END__ =pod =encoding UTF-8 =head1 NAME Rinci::package - Metadata for your namespaces/packages =head1 SPECIFICATION VERSION 1.1 =head1 VERSION This document describes version 1.1.100 of Rinci::package (from Perl distribution Rinci), released on 2022-01-23. =head1 INTRODUCTION This document describes metadata for namespaces/packages. This specification is part of L. Please do a read up on it first, if you have not already done so. =head1 SPECIFICATION B The term "package" from Perl 5 is used here, where it just means namespace. Perl also happens to use package to implement class, but metadata for classes will be specified in another specification (L). =head1 FAQ =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 SEE ALSO L =head1 AUTHOR perlancar =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. 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 want to build the distribution (e.g. to try to install it locally on your system), you can install L, L, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =cut Rinci-1.1.100/lib/Rinci/FAQ.pod0000644000175000017500000001531714173151307013304 0ustar s1s1package Rinci::FAQ; # just to make PodWeaver happy # AUTHORITY # DATE our $DIST = 'Rinci'; # DIST # VERSION 1; # ABSTRACT: FAQ on Rinci __END__ =pod =encoding UTF-8 =head1 NAME Rinci::FAQ - FAQ on Rinci =head1 VERSION This document describes version 1.1.100 of Rinci::FAQ (from Perl distribution Rinci), released on 2022-01-23. =head1 FAQ =head2 Rinci::function =over =item * Why do you make enveloped result an array instead of hash? For example, a hash-based enveloped result can be something like: {status=>200, message=>"OK", result=>42, meta1=>..., meta2=>...} This has the benefit of a single container, but I picked array because of the brevity for simple cases (which are the majority), e.g.: [200] # versus {status=>200} [200, "OK"] # versus {status=>200, message=>"OK"} When handling enveloped result, the array version is also shorter: if ($res->[0] == 200) { ... } # versus: if ($res->{status} == 200) { ... } print "Error $res->[0] - $res->[1]"; # versus: print "Error $res->{status} - $res->{message}"; The hash version is more obvious for first-time reader, but after just some amount of time, C<< $res->[0] >>, C<< $res->[1] >> will become obvious if you use it consistently. As a bonus, arrays are faster and more space-efficient than hashes. =item * How do you indicate transient/temporary vs permanent errors? Some protocols, like SMTP or POP, defines 4xx codes as temporary errors and 5xx as permanent ones. This gives clue to clients whether to retry or not. HTTP, which Rinci is modelled after, does not provide such distinction to its status codes. However, Rinci defines a C result metadata that can be used for such purpose, e.g.: [500, "Can't submit mail, we are being blocked by RBL", undef, {perm_err=>0}] [500, "Can't submit mail, destination address does not exist", undef, {perm_err=>1}] =item * How to handle binary data? To accept binary data, you can set one or more arguments as having the schema type C (instead of C): args => { data => { schema => 'buf*', req=>1 }, } To return binary data, you can set result's schema type to C, e.g.: result => { schema => 'buf*' } For handling binary data when writing Perl-based command-line applications, see L. =item * How to accept partial data? First, set an argument property C to true to signify that this argument accept partial value. You can then call with special arguments C<-arg_len>, C<-arg_part_start>, C<-arg_part_len>. See L for more details. L can also do this via HTTP Content-Range. =item * How to accept streaming input? Many program environments (like in Unix) have the concept of standard input. Rinci provides a thin abstraction over this. You can set the argument property C to true. This way, in most implementation like in Perl, your function will receive the argument value as filehandle which it can then read from. See C property in C function metadata property in L for an example. Your function can also read from standard input directly, but this means you cannot use conveniences like the C, where the command-line framework can supply an argument value for you from various sources including standard input and/or files. =item * How to produce streaming output? Many program environments (like in Unix) have the concept of standard output. To produce output stream, you can set result metadata property C to true. And then in the result you can put a filehandle or an object that responds to getline/getitem methods. =item * What is the difference between accepting partial data and streaming input? If a function accepts partial data, to send a large data without taking up too much memory, a caller needs to break the data into several parts and call the function several times, each with a different part. If a function accepts a stream input, to send a large data a caller can send a filehandle/iterator object from which the function can read the data iteratively. Stream input is easier and simpler for the function writer to write. A caller also only needs to call the function once instead of multiple times. However, there is no resume capability. On the other hand, partial input data is easier to implement with Riap::HTTP, as it maps rather closely to HTTP Content-Range. If you are uploading a large data over a network to a function, partial input data is preferred because of its ease to work with HTTP and its resume ability. However, if input is really a stream (i.e. unknown/infinite length), then streaming input is the option to use. =item * What is the difference between returning partial result and streaming output? If a function can return partial result, to retrieve a large result from a function a caller can calls several times and each time request to retrieve parts of result. If a function returns output stream, a caller can then retrieve data from the stream iteratively. Output stream is easier to handle by the caller. The caller also only needs to call once instead of multiple times. However, there is no resume capability. On the other hand, partial result is easier to implement with Riap::HTTP, as it maps rather closely to HTTP Content-Range. If you are retrieving a large data over a network from a function, partial result is preferred because of its ease to work with HTTP =back =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 AUTHOR perlancar =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. 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 want to build the distribution (e.g. to try to install it locally on your system), you can install L, L, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =cut Rinci-1.1.100/lib/Rinci/function.pod0000644000175000017500000015076214173151307014526 0ustar s1s1package Rinci::function; # just to make PodWeaver happy # AUTHORITY # DATE our $DIST = 'Rinci'; # DIST # VERSION 1; # ABSTRACT: Metadata for your functions/methods __END__ =pod =encoding UTF-8 =head1 NAME Rinci::function - Metadata for your functions/methods =head1 SPECIFICATION VERSION 1.1 =head1 VERSION This document describes version 1.1.100 of Rinci::function (from Perl distribution Rinci), released on 2022-01-23. =head1 INTRODUCTION This document describes metadata for functions/methods. Since the metadata properties describe features and the way a function works, this document also describes how a function should support those properties. This specification is part of L. Please do a read up on it first, if you have not already done so. =head1 SPECIFICATION =head2 Enveloped result Function should return an enveloped result to express error code/message as well as actual result. The envelope can be produced by the function itself, or added by a wrapper tool. Result envelope is modeled after HTTP or L response; it is an array in the following format: [STATUS*, MESSAGE, RESULT, META] STATUS is a 3-digit integer and is the only required element, much like HTTP response status code and is explained further in L. MESSAGE is a string containing error message. RESULT (or PAYLOAD) is the actual content to be returned and can be omitted or set to undef if the function does not need to return anything. META is called result metadata, a defhash containing extra data, analogous to HTTP response headers. Result metadata is specified further in L. Some example of an enveloped results: [200] [200, "OK", 42] [404, "Not found"] [200, "Account created", {id=>9323}, {}] [500, "Can't delete foo: permission denied", undef, {"cmdline.exit_code"=>300, perm_err=>1}] As mentioned, an enveloped result can contain error code/message as well as the actual result. It can also be easily converted to HTTP response message. And it can also contain extra data, useful for things like the transaction protocol (explained in L). =head2 Special arguments Special arguments are some known arguments that start with dash (C<->) and serve special purposes. You need not specify them in the C metadata property. Examples of special arguments include C<-dry_run>, C<-tx_action>, C<-action>, C<-confirm/*>, C<-arg_part_start>, C<-arg_part_len>, C<-res_part_start>, C<-res_part_len>. Many of them will be explained in other related sections/documents, but some will be described here: =over =item * -content_type_ARGNAME This special argument can be used to describe the MIME content type of an argument, where C is the argument name. For example, if you are creating a function that accepts data upload (in Perl): upload(data => '...', -content_type_data => 'image/jpeg'); =back =head2 Functions vs methods Since in many programming languages (like Perl 5, Python, Ruby, PHP) static functions are not that differentiated from methods, functions and methods share the same Rinci spec. But there are certain properties that can be used to declare if a function is (also) a method or not. See C, C, C properties below for details. =head2 Multiple dispatch This specification also does not (yet) have any recommendation on how to best handle functions in languages that support multiple dispatch, like Perl 6: whether we should create multiple metadata or just one. It is more up to the tool and what you want to do with the metadata. =head2 Envelope status codes In general, status codes map directly to HTTP response status codes. Below are the suggestion on which codes to use (or avoid). An asterisk (C<*>) marks which codes are not defined in HTTP specification and introduced by this specification. =over =item * 1xx code Currently not used. Some tools like L assumes that status code is always C<< >= 200 >>, so you should perhaps never used status less than 200. =item * 2xx code - success 200 should be used to mean success. 201 (created) can be used to signal success when creating something. 204 (no content) can also be used when there is no content to show. In HTTP, browsers won't clear current page if response is 206 (instead of showing a blank page if response is 200). Currently in Rinci there is no difference between 200 and 204. 206 (partial content) can be used to signal partial content. See C property in the C function property. 207 (multistatus) can be used to signal partial success, for example a function which processed 5 items wanted to report that it successfully processed 2 items but failed to process the rest 3 items. For each item's statuses, you can use result metadata property C. Note: 207 is used by WebDAV. Note: When all functions instead of only some/partial items fail, you might want to return 4xx or 5xx instead of 207. =item * 3xx code - further actions needs to be taken by user agent (caller) 301 (moved) can be used to redirect callers to alternate location, although this is very rare. 304 (not modified, nothing done). Used for example by setup functions to indicate that nothing is being modified or no modifying action has been performed (see Setup::* modules in CPAN). 331* (confirmation required). Function requires confirmation, for example if action to be taken is dangerous or requires user's attention. Confirmation message/prompt from function can be returned in the message, or in the C property (e.g. to provide translations). Confirmation from caller is in the form of special argument C<-confirm> with boolean value of true (TODO: A more detailed confirmation for different actions can be specified later in the form of C<-confirm_XXX> special arguments.) For an example of application of this, see L. =item * 4xx code - client (caller) side error 400 (bad request, bad arguments) should be returned when the function encounters invalid input. A function wrapper can return this code when the function arguments fail the argument schema validation (specified in the C property). 401 (authentication required). 403 (forbidden, access denied, authorization failed). 404 (not found). Can be used for example by an object-retrieval functions (like C) and the object is not found. For object-listing functions (like C), when there are no users found matching the requested criteria, 200 code should still be returned with an empty result (like an empty array or hash). Also in general, an object-deletion function (like C) should also return 200 (or perhaps 304, but 200 is preferred) instead of 404 when the object specified to be deleted is not found, since the goal of the delete function is reached anyway. 408 (request timeout). 409 (conflict). Can be used for example by a C function when receiving an already existing username. 412 (precondition failed). Similar to 409, but can be used to indicate lack of resources, like disk space or bandwidth. For lacking authentication and authorization, use 401 and 403 respectively. 413 (request range not satisfiable). When client requests partial result outside the range of available. See the C property in C property for examples. 429 (too many requests). (EXPERIMENTAL) 44x* codes are reserved for function-specific codes. Each function is free to define what each number means. However, this is not really encouraged and should only be used if necessary. Function should perhaps stick to predefined codes here. To return more detailed status, result metadata can be used. 480* is general transaction error, e.g. transaction status is aborted so further requests for this transaction is ignored until transaction is aborted. 484* (no such transaction). =item * 5xx code - server (callee) side error 500 is the general code to use when a failure occurs during the execution of a function. for example when a C function fails to delete specified file (though in this case it can also choose to return 403 instead, which is more specific). 501 (not implemented) 503 (service unavailable). You can use this when service is temporarily unavailable, e.g. when system load is too high, a required service is down, etc. Users should try again at a later time. 507 (insufficient storage) 521 (maximum retries reached) 531* (bad metadata) is used when there is something wrong with the metadata. 532* (failure in recording transaction) when there is a failure in updating transaction status or in preparing/committing/rolling back the transaction. (EXPERIMENTAL) 54x* codes are reserved for function-specific codes. Each function is free to define what each number means. However, this is not really encouraged and should only be used if necessary. Function should perhaps stick to predefined codes here. To return more detailed status, result metadata can be used. Try not to use code greater than 555, as some tools use (CODE-300) for error codes that must fit in one unsigned byte (like L). =back =head2 is_func Bool. Specify that the function can be called as a static function (i.e. procedural, not as a method). Default is true if unspecified, but becomes false if is_meth or is_class_meth is set to true. Example: # specify that function can be called a method *as well as* a static function is_meth => 1 is_func => 1 # if not specified, will default to false after is_meth set to 1 =head2 is_meth Bool. Specify that the function can be called as an instance (object) method. Default is false. Example: # specify that function is a method is_meth => 1 =head2 is_class_meth Bool. Specify that the function can be called as a class method. Examples of class methods include the constructor, but there are others. Default is false. Example: # specify that function is a class method is_class_meth => 1 =head2 args (function property) Hash. Specify arguments. Property value is defhash of argument names and argument specification. Argument name must only contain letters, numbers, and underscores (and do not start with a number). Argument specification is a hash containing these keys: =head3 schema (argument property) L schema for argument value. =head3 default Any. Give default value for argument. This takes precedence over schema, which can also specify default value. This is useful if you want to share a common schema over several arguments but want to have different default for each argument. For example, you have a C schema. In C function you want the default C argument to be C, while in C you want the default C to be C. =head3 summary (argument property) Str. From DefHash. A one-line plaintext summary, much like the C property in variable metadata. =head3 req Bool. Specify that argument is required (although its value can be undef/null). Default is false. =head3 description (argument property) Str. From DefHash. A longer description of marked up text, much like the C property. It is suggested to format the text to 74 columns. =head3 tags (argument property) Array of (str|hash). From DefHash. An array of tags, can be used by tools to categorize arguments. Not unlike the C property. =head3 pos Non-negative integer. Argument position when specified in an ordered fashion, e.g. in an array. Starts from zero. =head3 slurpy Bool. Only relevant if B is specified, specify whether argument should gobble up all remaining values in an ordered argument list into an array. Old alias: L =head3 greedy Old alias for L. Will be removed in Rinci 1.2. =head3 partial (argument property) Bool. Whether or not argument value can be sent partially. Only argument types that have a length notion can be set as partial (e.g. C where the unit is character, C where the unit is byte, and C where the unit is element). There should at most be one argument with this property set to true. To send partial argument, you can use the special arguments C<-arg_len> (total argument length), C<-arg_part_start> (start position of the part that is being sent), C<-arg_part_len> (length of part that is being sent). Example (in Perl): # function metadata { v => 1.1, summary => "Upload a file", args => { name => {schema=>"str*", req=>1}, data => {schema=>"buf*", req=>1, partial=>1}, }, } # function usage example: send the first 10MiB of data upload_file(name=>"myvideo.mp4", data=>substr($data, 0, 10_000_000), -arg_len => 24_500_000, -arg_part_start => 0, -arg_part_len => 10_000_000); # send the next 10MiB upload_file(name=>"myvideo.mp4", data=>substr($data, 10_000_000, 10_000_000), -arg_len => 24_500_000, -arg_part_start => 10_000_000, -arg_part_len => 10_000_000); # send the last 4.5 MiB upload_file(name=>"myvideo.mp4", data=>substr($data, 20_000_000), -arg_len => 24_500_000, -arg_part_start => 20_000_000, -arg_part_len => 4_500_000); =head3 stream (argument property) Bool. By setting this property to true, function can specify that it accepts streaming data for this argument. It is useful when argument value is large or of undetermined/infinite length. To send value as a stream, caller must send a subroutine reference (callback) instead which the function will call repeatedly until it gets undef to signify exhaustion of data. =head3 cmdline_aliases Hash. Specify aliases for use in command-line options (or other possibly suitable situation where arguments are parsed from command-line-like options). Keys are alias names, values are itself hashes (alias specification). Valid alias specification keys: C (a string, optional), C (optional, defaults to argument's schema), C (bool, optional, if set to 1 then it is a shortcut for specifying C to C<< ["bool", {"is":1}] >>), C (a code to set argument value, optional, will be given C<< (\%args, $val) >>); if not set, the default behavior is simply to set the argument value). =head3 cmdline_on_getopt Code. A hook that will be called when argument is specified as a command-line option. In Perl, hook will be called with a hash argument containing this key: C (str, argument name), C (str, option value), C (hash, the argument hash defined so far). This can be useful if you want to process a command-line option directly on a per-option basis instead of getting the final resulting argument value. For example (in Perl): args => { library => { schema => ['array*' => of => 'str*'], cmdline_aliases => { I => {} }, cmdline_on_getopt => sub { my %args = @_; require lib; lib->import($args{value}); }, }, module => { schema => ['array*' => of => 'str*'], cmdline_aliases => { M => {} }, cmdline_on_getopt => sub { my %args = @_; require Module::Load; Module::Load::load($args{value}); }, }, } With command-line argument like this: -I dir1 -M mod1 -I dir2 -M mod2 Without any C hooks, the function will receive this argument hash: { library => ['dir1', 'dir2'], module => ['mod1', 'mod2'] } but there is no way to know the order of options being specified in the command-line. With the hooks, the function can load modules correctly (e.g. loading C won't search in C as that directory has not been added by -I). =head3 completion (argument property) Code. A code to supply argument value completion. Will be explained in the examples. =head3 index_completion Code. A code to supply argument element index completion. Applicable to the following argument types: B: for completing hash pair keys. (See also C for completing hash pair values). See examples for how to use this property. =head3 element_completion Code. A code to supply argument element value completion. Applicable to the following argument types: B: for completing array element values. B: for completing hash pair values. (See also C for completing hash keys). See examples for how to use this property. =head3 is_password Experimental. Bool. Describe that argument holds password. Programs can react to this in several ways, for example they can turn off echoing to terminal when asking value from standard input. Or they can redact values to C<****> when logging. =head3 cmdline_src Str. Normally in a command-line program, command-line options and arguments will map to function arguments, e.g. C<--arg 2> will set the C argument to C<2> and positional arguments (argument which specifies the C property and optionally also a C property with true value) will get or slurp command-line arguments. In some cases, this is not convenient. When supplying larger amount of data, a complex structures, or a stream, we might want to use other sources. The C property can be set to one of the following value for this purpose: =over =item * file Command-line option/argument value will be treated as filename and function argument will be set to content of the file (or in the case of streaming argument, to a callback which can be used to get the file's content). =item * stdin This means that program should get function argument from the whole standard input until EOF. Note that only one argument can have its source set to C or C or C or C. =item * stdin_or_file This means that program should get argument value from content of file (the name of which is given from the first remaining command-line argument after all other arguments/options have been processed), or, if none is provided, from standard input. =item * stdin_or_files This means that program should get argument value from content of files (the names of which are taken from the remaining command-line arguments after all other arguments/options have been processed), or, or if no command-line argument remains, from standard input. This behavior is similar to the C<< <> >> (diamond operator) in Perl. =item * stdin_or_args This means that program should get argument value from remaining command-line argument(s), or if no command-line argument remains, from standard input. =item * stdin_line This means that program should get argument value from a line of standard input; newline ending will be removed from the argument value. Arguments with C of C will be processed before C/C/C/C. =back Other sources might be defined in the future. TODO: Define C property? TODO: A way to define record separator? =head3 cmdline_prompt Str. String to display when asking for argument value from stdin (if C property value is C. TODO: cmdline_prompt_template? =head3 meta Experimental. Hash. This allows specifying argument submetadata, used e.g. when dealing with forms (a form field/widget can be a subform). Value is Rinci function metadata. =head3 element_meta Experimental. Hash. This allows specifying argument element submetadata, used e.g. when dealing with forms (a form field/widget can contain an array of records/subforms). Value is Rinci function metadata. =head3 deps (argument property) Hash. This property specifies argument's dependencies to other arguments (but possibly to other things too, in the future). This is similar to function's L property. It is a hash or dep types and values. The most important dep type is C (dependency to another argument). Some dep types are special: C, C, C. Example: args => { delete => { schema=>'bool', }, force => { summary => 'Force deletion', schema => 'bool', deps => {arg=>'delete'}, }, The above example states that argument C "depends on" C. What it means (usually) is that specifying C only makes sense when C is also specified. In a CLI context: % prog --delete --force Specifying C<--force> without C<--delete> doesn't make sense. =head3 filters Experimental. Array of string, or code. Filters to apply before argument is converted from text and validated. =head3 examples (argument property) Array. Each element is sample argument values. But if it is a hash, will be assumed as a DefHash with the actual value put in the C property (so if your sample argument is a hash like C<{}> (in JSON), you have to specify it as C<< {"value":{}, "summary":"Optional summary..."} >> (in JSON). Note that a Sah schema can also have an L clause which you can use to put examples in. And Rinci function metadata also has L property too. Example function metadata and its implementation in Perl: $SPEC{multiply2} = { v => 1.1, summary => 'Multiple two numbers', args => { a => { summary => 'The first operand', description => '... a longer description ...', schema=>['float*', { examples => [1, -10, 0, 3.333], }], pos => 0, tags => ['category:operand'], }, b => { summary => 'The second operand', description => '... a longer description ...', schema => 'float*', pos => 1, tags => ['category:operand'], examples => [ 1, -10, 0, 3.333, {value => 1e-10, summary => 'Blah blah'}, ], }, round => { summary => 'Whether to round result', description => '... a longer description ...', schema => [bool => {default=>0}], pos => 2, tags => ['category:options'], cmdline_aliases => { r=>{}, R=>{summary=>'Equivalent to --round=0', code=>sub { my ($args, $val) = @_; $args->{round}=0 }}, }, }, } }; sub multiply2 { my %args = @_; my $res = $args{a} * $args{b}; $res = int($res) if $round; [200, "OK", $res]; } By default, without any wrapper, the function is called with a named hash style: multiply2(a=>4, b=>3); # 12 But with the information from the metadata, a wrapper tool like Perinci::Sub::Wrapper is able to change the calling style to positional: multiply2(4, 3.1, 1); # 12 A command-line tool will also enable the function to be called named options as well as positional arguments: % multiply2 --a 2 --b 3 % multiply2 2 --b 3 % multiply2 2 3 As mentioned earlier, C is parsed by command-line option parser: % multiply2 2 3.5 -r ; # equivalent to multiply2 2 3 --round % multiply2 2 3.5 -R ; # equivalent to multiply2 2 3 --noround (--round=0) Aliases in C are not recognized as real arguments: multiply2(a=>4, b=>3, r=>0); # unknown argument r Another example (demonstrates C): $SPEC{smtpd} = { v => 1.1, summary => 'Control SMTP daemon', args => { action => { schema => ['str*' => {in=>[qw/status start stop restart/]}], pos => 0, req => 1, cmdline_aliases => { status => { schema => [bool=>{is=>1}], summary => 'Alias for setting action=status', code => sub { $_[0]{action} = 'status' }, }, start => { schema => [bool=>{is=>1}], summary => 'Alias for setting action=start', code => sub { $_[0]{action} = 'start' }, }, stop => { schema => [bool=>{is=>1}], summary => 'Alias for setting action=stop', code => sub { $_[0]{action} = 'stop' }, }, restart => { schema => [bool=>{is=>1}], summary => 'Alias for setting action=restart', code => sub { $_[0]{action} = 'restart' }, }, }, }, force => { schema => 'bool', }, }, }; Another example (demonstrates B): $SPEC{multiply_many} = { v => 1.1, summary => 'Multiple numbers', args => { nums => { schema => ['array*' => {of=>'num*', min_len=>1}], pos => 0, slurpy => 1 }, }, }; sub multiply_many { my %args = @_; my $nums = $args{nums}; my $ans = 1; $ans *= $_ for @$nums; [200, "OK", $ans]; } After wrapping, in positional mode it can then be called: multiply_many(2, 3, 4); # 24 which is the same as (in normal named-argument style): multiply_many(nums => [2, 3, 4]); # 24 In command-line: % multiply-many 2 3 4 in addition to the normal: % multiply-many --nums '[2, 3, 4]' B. This argument specification key specifies how to complete argument value (e.g. in shell or L) and is supplied an anonymous function as value. The function will be called with arguments: word=>... (which is the formed word so far, ci=>0|1 (whether completion should be done case-insensitively). The function should return an array containing a list of possible candidates, or a hash containing these keys: C (array, list of possible candidates) and extra keys for formatting hints e.g. C (bool, whether the list of completion is path-like, meaning it can be traversed/dug to multiple levels) C (string, path separator character), C (string, either C, C, or other types). For an example of implementation for this, see L in Perl which provides tab completion for argument values. Example: $SPEC{delete_user} = { v => 1.1, args => { username => { schema => 'str*', pos => 0, completion => sub { my %args = @_; my $word = $args{word} // ""; # find users beginning with $word local $CWD = "/home"; return [grep {-d && $_ ~~ /^\Q$word/} <*>]; }, }, force => {schema=>[bool => {default=>0}]}, }, }; When C is executed over the command line and the Tab key is pressed: $ delete-user --force --username fo $ delete-user fo then B will try to complete with usernames starting with C. B. This is like B, but for array or hash elements. Argument type must be C or C. Example for array: $SPEC{delete_users} = { v => 1.1, args => { usernames => { schema => ['array*' => of => 'str*'], req => 1, pos => 0, slurpy => 1, element_completion => sub { my %args = @_; my $word = $args{word} // ""; # find users beginning with $word local $CWD = "/home"; my $res = [grep {-d && $_ ~~ /^\Q$word/} <*>]; # exclude users already mentioned by user my $ary = $args{args}{usernames}; $res = [grep {!($_ ~~ @$ary)}] @$res; return $res; }, }, }, }; When C is executed over the command line: $ delete-users c ; # will complete with all users beginning with c $ delete-users charlie c ; # will complete with users but exclude charlie $ delete-users charlie chucky ; # and so on Example for hash (as well as B property to complete hash keys): $SPEC{create_file} = { v => 1.1, args => { filename => { schema => 'str*', req => 1, pos => 0, }, content => { schema => 'buf*', req => 1, pos => 1, }, mode => { summary => 'Permission mode', schema => 'posint*', }, extra_attrs => { 'x.name.is_plural' => 1, 'x.name.singular' => 'extra_attr', schema => ['hash*' => of => 'str*'], index_completion => sub { # complete with list of known attributes my %args = @_; require Complete::Util; Complete::Util::complete_array_elem( word => $args{word}, array => [qw/mtime ctime owner group/], ); }, element_completion => sub { my %args = @_; my $word = $args{word} // ""; my $index = $args{index}; if ($index eq 'owner') { require Complete::Unix; return Complete::Unix::complete_user(word=>$word); } elsif ($index eq 'group') { require Complete::Unix; return Complete::Unix::complete_group(word=>$word); } else { return undef; } }, }, }, }; When C is executed over the command line: $ create-file file1 "hello filesystem" --extra-attr ; # will complete with list of known attributes $ create-file file1 "hello filesystem" --extra-attr owner=; # will complete with list of Unix users =head2 args_rels Hash. This property is used to expression relationships between arguments. The value is actually L schema hash clause set (see hash type in L). The arguments are represented as a hash, and you can use the various Sah clauses to express relationships between the arguments (hash keys) because the Sah hash type supports such clauses, e.g. C, C, C, C, C, C, C, C. Examples: args_rels => { choose_one => ['delete', 'add', 'edit'], choose_all => ['red', 'green', 'blue'], } The above example says that only one of C, C, C can be specified. And if any of C, C, C is specified then all must be specified. In CLI context this translates to: % prog --delete item % prog --delete --add item ; # error, both --delete and --add specified % prog --red 255 --green 255 --blue 0 % prog --red 255 --blue 0 ; # error, --green is missing Another example: XXX =head2 args_as Str. Specify in what form the function expects the arguments. The value is actually implementation-specific since it describes the function implementation. For example in L for Perl, these values are recognized: C, C, C, C. This property is useful for wrapper to be able to convert one form to another. The default value is also left to the implementation. For interimplementation communication (e.g. via L or L), named arguments are always used so this property is irrelevant. =head2 result DefHash. Specify function return value. It is a defhash containing keys: =over 4 =item * summary (result property) From DefHash. Like the C property in variable metadata. =item * description (result property) From DefHash. Like the C property. Suggested to be formatted to 78 columns. =item * schema (result property) A Sah schema to validate the result (the third element in the envelope result). This schema should only be tested if status is 200. See also: C. =item * statuses Hash. Can be used to specify different result schema for different statuses. For example: statuses => { 206 => { schema => 'str*', }, } =item * stream (result property) Bool. Specify that function returns streaming output. Note that function can also signify streaming output by setting result metadata property C to true. Function must then return a subroutine reference (callback) as its actual result which the caller can call repeatedly until it gets undef to signify exhaustion. =item * partial (result property) Bool. If set to true, specify that it is possible to request partial result. An example is in a function that reads contents from (potentially large) files: # function metadata { v => 1.1, summary => 'Read file contents', args => { name => { summary => 'File name', schema => 'str*', req => 1, }, }, result => {schema=>'buf*', partial=>1}, } # example function usage: request to read first 10MiB of file content, # -result_part_start defaults to 0. my $res = read_file(name=>'myvideo.mp4', -res_part_len=>10000000); # => [206, "Partial content", "data...", {len=>24500000, part_start=>0, part_len=>10000000}] # request the next 10MiB my $res = read_file(name=>'myvideo.mp4', -res_part_start=>10000000, -res_part_len=>10000000); # => [206, "Partial content", "data...", {len=>24500000, part_start=>10000000, part_len=>10000000}] # request the next 10MiB, since this actual file size is only 24500000, # function should return 416 status my $res = read_file(name=>'myvideo.mp4', -res_part_start=>20000000, -res_part_len=>10000000); # => [416, "Request range not satisfiable, file size is only 24500000"] # request the next 4.5MiB, this time succeeds my $res = read_file(name=>'myvideo.mp4', -res_part_start=>20000000, -res_part_len=>4500000); # => [206, "Partial content", "data...", {len=>24500000, part_start=>20000000, part_len=>4500000}] Partial result request to a function which does not support partial result might have the effect of the whole content being returned (status 200) or status 416. =back Note that since functions normally return enveloped result, instead of returning: RESULT your functions normally have to return an enveloped result: [STATUS, MESSAGE, RESULT, METADATA] Examples: # result is an integer result => {schema => 'int*'} # result is an integer starting from zero result => {schema => ['int*' => {ge=>0}]} # result is an array of records result => { summary => 'Matching addressbook entries', schema => ['array*' => { summary => 'blah blah blah ...', of => ['hash*' => {allowed_keys=>[qw/name age address/]} ] }] } =head2 result_naked Bool. If set to true, specify that function does not envelope its results. The default is false, to encourage functions to create envelopes. However, wrapper should be able to create or strip envelope if needed. For example, if you have "traditional" functions which does not do envelopes, you can set this property to true, and the wrapper can generate the envelope for the functions. =head2 examples (function property) Array. This property allows you to put examples in a detailed and structured way, as an alternative to putting everything in C. Each example is a defhash, it specifies what arguments are used, what the results are, and some description. It can be used when generating API/usage documentation, as well as for testing data. It can also be used for testing (function will be run with specified arguments and the result will be matched against expected result). Known properties: =over 4 =item * args (function example property) Hash. Arguments used to produce result. Can be converted to C by tool, e.g. when displaying command-line examples. =item * argv Array. An alternative to C, for example when function is run from the command-line. Can be converted to C most of the time when wanting to display examples in Perl instead of command-line. =item * src Str. An alternative to C or C, to provide raw source code. See also: C. This can be used to show more general examples. For example, you can show how a function is used in an expression or code block, or how a command-line program is used in a shell script. Exactly one of C, C, or C must be specified. =item * src_plang Str. The programming language the examples source code C is written in. Valid values include: C, C. Command-line interface tools will typically only show examples written in C or other shells, while Perl module tools will typically only show C examples. Required if C is specified. =item * status Int. Status from envelope. If unspecified, assumed to be 200. =item * result Any. Expected result. =item * env_result Array. Expected enveloped result. =item * naked_result Any. Expected naked result (payload). =item * summary (function example property) From DefHash. A one-line summary of the example You should describe, in one phrase or sentence, what the example tries to demonstrate. You can skip the summary if the example is pretty basic or things are already clear from the C alone. =item * description (function example property) From DefHash. Longer marked up text about the example (e.g. discussion or things to note), suggested to be formatted to 72 columns. =item * tags (function example property) From DefHash. =item * test Bool. Defaults to true. Whether to actually test example or not. Examples are by default run as tests by a test module (e.g. Perl module L. Setting this to 0 disables this example from being included in a test. TODO: more detailed testing instruction (e.g. only test in release candidate, or under certain environment flag, etc). =back Example: # part of metadata for Math::is_prime function examples => [ { args => {num=>10}, result => 0, # summary no needed here, already clear. }, { args => {}, result => 400, summary => 'Num argument is required', }, { argv => [-5], result => 1, summary => 'Also works for negative integers', }, ], Another example demonstrating C for a function called C: examples => [ { src => 'for c in `list-countries`; do wget http://flags.org/country/$c; done', src_plang => 'bash', }, { src => <<'EOT', my $res = list_countries(detail => 1, sort=>['-popsize']); die "Can't list countries: $res->[0] - $res->[1]" unless $res->[0] == 200; my $i = 0; for my $c (@{ $res->[2] }) { $i++; say "$i. $_->{name}'s population: $_->{popsize}"; EOT src_plang => 'perl', }, ], =head2 features DefHash. Allows functions to express their features. Each hash key contains feature name, which must only contain letters/numbers/underscores. Below is the list of defined features. New feature names may be defined by extension. =over 4 =item * reverse Bool. Default: false. If set to true, specifies that function supports reverse operation. To reverse, caller can add special argument C<-reverse>. For example: $SPEC{triple} = { v => 1.1, args => {num=>{schema=>'num*'}}, features => {reverse=>1} }; sub triple { my %args = @_; my $num = $args{num}; [200, "OK", $args{-reverse} ? $num/3 : $num*3]; } triple(num=>12); # => 36 triple(num=>12, -reverse=>1); # => 4 =item * tx Hash. Default is none. Specify transactional support, as specified in L. Value is a hash containing these keys: C (int, protocol version, default if not specified is 1). Please see Rinci::Transaction for more details on transaction. =item * dry_run Bool, or hash. If set to a true value, specifies that function supports dry-run (simulation) mode. Can also be set to a hash like this: C<<{default=>1}>> to mean that function supports dry-run and the default is dry-run mode. Example: use Log::ger; $SPEC{rmre} = { summary => 'Delete files in curdir matching a regex', args => {re=>{schema=>'str*'}}, features => {dry_run=>1} }; sub rmre { my %args = @_; my $re = qr/$args{re}/; my $dry_run = $args{-dry_run}; opendir my($dir), "."; while (my $f = readdir($dir)) { next unless $f =~ $re; log_info "Deleting $f ..."; next if $dry_run; unlink $f; } [200, "OK"]; } The above Perl function delete files, but if passed argument C<-dry_run> => 1 (simulation mode), will not actually delete files, only display what files match the criteria and would have be deleted. Specifying a function as supporting dry_run means, among others: =over 4 =item * If dry_run is requested, function will have no side effects It will behave like a pure function, and thus have the properties of a pure function. =back =item * pure Bool. Default: false. If set to true, specifies that function is "pure" and has no "side effects" (these are terms from functional programming / computer science). Having a side effect means changing something, somewhere (e.g. setting the value of a global variable, modifies its arguments, writing some data to disk, changing system date/time, etc.) Specifying a function as pure means, among others: =over 4 =item * it can safely be inculded in transaction without recording in journal; =item * it can safely be included during dry run; =back =item * immutable Bool. Default is false. If set to true, specifies that function always returns the same result when given the same argument values. This enables optimization like memoization. An example of an immutable function is C where its results only depend on the arguments. Example of a mutable function would be C or C that reads contents from a file. =item * idempotent Bool. Default is false. If set to true, specifies that function is idempotent. Idempotency means that repeated invocation of a function (each with the same arguments) will have the same effect as a single invocation. In other words, extra invocation will not have any effect. Some operations, like reading a database row or a file's content, is inherently idempotent (or to be exact nullipotent). Another example is setting or updating an entity to some specific value, or deleting some entity. Repeated invocation of the operation will still sets the entity to the same value, or still deletes the entity. Some other operations are inherently non-idempotent, for example sending an email. Repeated invocation will cause multiple emails to be sent. Yet some other operations are non-idempotent, but can be made idempotent simply by checking whether the target object(s) has (have) reached the final desired state, (optionally additionally also checking whether they are in the correct original state to begin with). For example, a function that renames a file can record the original file that was renamed (its MD5 checksum, size, or what not) or perhaps record the action in a history database or flag file, and refuse to rename again if the file to be renamed is not the original file. =item * check_arg Bool. Default is false. If set to true, specifies that function supports the action of checking only a single argument. Usually useful when doing form processing, where we want to check only a single form field (function argument). To check a single argument, one passes C<-action> special argument with the value of C and also passes the argument she wants to check. Function should check that argument and immediately return 200 status upon success, or 400 upon validation failure. =back =head2 deps (function property) Hash. This property specifies function's dependencies to various things. It is a hash of dep types and values. Some dep types are special: C, C, and C. deps => { DEPTYPE => DEPVALUE, ..., all => [ {DEPTYPE=>DEPVALUE, ...}, ..., }, any => [ {DEPTYPE => DEPVALUE, ...}, ..., ], none => [ {DEPTYPE => DEPVALUE, ...}, ...., ], } A dependency can be of any type: another function, environment variables, programs, OS software packages, etc. It is up to the dependency checker library to make use of this information. For the dependencies to be declared as satisfied, all of the clauses must be satisfied. Below is the list of defined dependency types. New dependency type may be defined by an extension. =over 4 =item * env Str. Require that an environment variable exists and is true, where true is in the Perl sense (not an empty string or "0"; " " and "0.0" are both true). Example: env => 'HTTPS' =item * prog Str. Require that a program exists. If STR doesn't contain path separator character '/' it will be searched in PATH. Windows filesystem should also use Unix-style path, e.g. "C:/Program Files/Foo/Bar.exe". prog => 'rsync' # any rsync found on PATH prog => '/bin/su' # won't accept any other su =item * pkg Str. Specify dependency on a L package. STR must be a valid Riap package URI string. Checker can check that requesting C on this URI succeeds and the type is indeed C. Example: pkg => '/Foo/' =item * func Str. Specify dependency on a L function. STR must be a valid Riap function URI string. Checker can check that requesting C on this URI succeeds and the type is indeed C. Example: pkg => '/Foo/somefunc' pkg => 'http://gudangapi.com/ga/list_ubuntu_releases' =item * code Code. Require that anonymous function returns a true value after called, where the notion of true depends on the host language. Example in Perl: code => sub {$>} # i am not being run as root Example in Ruby: "code" => Proc.new { Process.euid > 0 } # i am not being run as root =item * tmp_dir Bool. If set to 1, specify that function requires temporary directory. Caller should provide path to this using special argument C<-tmp_dir>. =item * trash_dir Bool. If set to 1, specify that function requires trash directory. Trash is not unlike a temporary directory. Caller should provide path to trash directory using special argument C<-trash_dir>. Trash directory can be provided, e.g. by transaction manager (see L). =item * all Array of deps. A "meta" type that allows several dependencies to be joined together in a logical-AND fashion. All dependency hashes must be satisfied. For example, to declare a dependency to several programs and an environment variable: all => [ {prog => 'rsync'}, {prog => 'tar'}, {env => 'FORCE'}, ], =item * any Array of deps. Like C, but specify a logical-OR relationship. Any one of the dependencies will suffice. For example, to specify requirement to alternative Perl modules: or => [ {perl_module => 'HTTP::Daemon'}, {perl_module => 'HTTP::Daemon::SSL'}, ], =item * none Array of deps. Specify that none of the dependencies must be satisfied for this type to be satisfied. Example, to specify that the function not run under SUDO or by root: none => [ {env => 'SUDO_USER' }, {code => sub {$> != 0} }, ], Note that the above is not equivalent to below: none => [ {env => 'SUDO_USER', code => sub {$> != 0} }, ], which means that if none or only one of 'env'/'code' is satisfied, the whole dependency becomes a success (since it is negated by 'none'). Probably not what you want. =back If you add a new language-specific dependency type, please prefix it with the language code, e.g. C, C, C, C. These dependency types have also been defined by some existing tools: C (dependency to a Debian package), C (dependency to an RPM package), C (loading a remote JavaScript script URL), C (existence of a), C (running a Perl subroutine and getting a successful enveloped result). Some of these might be declared as part of the core dependency types in the future. =head1 FAQ =head2 What is the difference between C or C in the Sah schema and arg specification? Example: { args => { src => { summary => "Source path", description => "...", schema => ["str*", { summary => "...", description => "...", ... }], ... }, dest => { summary => "Target path", description => "...", schema => ["str*", { summary => "...", description => "...", ... }], ... }, ... }, } As you can see, each argument has a C and C, but the schema for each argument also has a C and C schema clauses. What is the difference and which should be put into which? The argument specification's C (and C) describe the argument itself, in this example it says that C means "The source path" and C means "The target path". The argument schema's C (and C) describe the data type and valid values. In this example it could say, e.g., "a Unix-path string with a maximum length of 255 characters". In fact, C and C are probably of the same type ("Unix path") and can share schema. { ... args => { src => { ... schema => "unix_path", }, dest => { ... schema => "unix_path", }, ... }, } =head2 What is the difference between setting req=>1 in the argument specification and req=>1 in schema? Example: # Note: remember that in Sah, str* is equivalent to [str => {req=>1}] args => { a => { schema=>"str" }, b => { schema=>"str*" }, c => { req=>1, schema=>"str" }, d => { req=>1, schema=>"str*" }, } In particular look at C and C. C is not a required argument (no req=>1 in the argument spec) but if it is specified, than it cannot be undef/null (since the schema says [str=>{req=>1}], a.k.a "str*"). On the other hand, C is a required argument (req=>1 in the argument spec) but you can specify undef/null as the value. The following are valid: func(c=>undef, d=>1); But the following are not: func(b=>1, d=>1); # c is not specified func(b=>undef, c=>1, d=>1); # b has undef value func(b=>1, c=>1, d=>undef); # d has undef value =head2 Should I add a new metadata property, or add a new feature name to the C property, or add a new dependency type to the C property? If your property describes a dependency to something, it should definitely be a new dependency type. If your property only describes what the function can do and does not include any wrapper code, then it probably goes into C. Otherwise, it should probably become a new metadata property. For example, if you want to declare that your function can only be run under a certain moon phase (e.g. full moon), it should definitely go as a new dependency type, so it becomes: deps => { moon_phase => 'full' }. Another example, C is a feature name, because it just states that if we pass C<-reverse> => 1 special argument to a reversible function, it can do a reverse operation. It doesn't include any wrapper code, all functionality is realized by the function itself. On the other hand, C is a metadata property because it involves adding adding some wrapping code (a timeout mechanism, e.g. an eval() block and alarm() in Perl). =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 SEE ALSO Related specifications: L, HTTP/1.1 (RFC 2068) L =head1 AUTHOR perlancar =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. 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 want to build the distribution (e.g. to try to install it locally on your system), you can install L, L, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =cut Rinci-1.1.100/lib/Rinci/resmeta.pod0000644000175000017500000001761214173151307014335 0ustar s1s1package Rinci::resmeta; # just to make PodWeaver happy # AUTHORITY # DATE our $DIST = 'Rinci'; # DIST # VERSION 1; # ABSTRACT: Function/method result metadata __END__ =pod =encoding UTF-8 =head1 NAME Rinci::resmeta - Function/method result metadata =head1 SPECIFICATION VERSION 1.1 =head1 VERSION This document describes version 1.1.100 of Rinci::resmeta (from Perl distribution Rinci), released on 2022-01-23. =head1 INTRODUCTION This document describes metadata for function/method result. This specification is part of L. Please do a read up on it first, if you have not already done so. =head1 SPECIFICATION There are currently several properties being used: =head2 cmdline.* Interpreted by L. See its documentation for more detail. =head2 content_type Value: str* (MIME content type) Can be used to describe the MIME content type of result. Example enveloped result (in Perl): [200, "OK", "...", {content_type => "image/jpeg"}] See also L. Note: borrowed from HTTP. =head2 func.* Value: any. These properties allow function to return extra results. Usually done to avoid breaking format of existing result (to maintain API compatibility). The attributes after C is up to the respective function. An example is the C function in the L Perl module. The function returns C<$args> but from v0.26 it also wants to give hints about whether or not there are missing arguments. It can do this via C result metadata. Some other examples (in Perl): # result from check_user() [200, "OK", 1, # 1 means valie { "func.detail" => { # detailed check result last_login => '2021-01-21T01:55:40Z', password_secure => 1, quota_exceeded => 0, }, }] =head2 func_content_type.* Value: str* (MIME content type) Can be used to describe the MIME content type of each extra result. Example (in Perl): func.attachment => '...', func_content_type.attachment => 'image/jpeg', See also L. =head2 len Value: int* The C, C and C properties specifies the range of data when function sends partial result. Suppose your function is returning a partial content of a large file where total file size is 24500000 bytes and the returned content is from bytes 10000000 to 15000000, then C is 24500000, C is 5000000, and C is 10000000. When returning partial content, status will be 206. =head2 location Value: str* (URL) Can be used to specify that the content is elsewhere. Used in combination with 301 or 302 result status. Example (in Perl): # result from a function that generates a chart [301, "Moved", undef, {content_type => "image/jpeg", location=>"file:/tmp/asd9uxzw.png"}] Note: borrowed from HTTP. =head2 logs Value: array[hash] Store log of events happening to this result, stored chronologically (older first). Each log should be a hash which should have at least the following keys: C