GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  RINCI::UPGRADING (3)

.ds Aq ’

NAME

Rinci::Upgrading - Upgrading from previous version of specification

CONTENTS

VERSION

This document describes version 1.1.79 of Rinci::Upgrading (from Perl distribution Rinci), released on 2016-02-25.

DESCRIPTION

This document gives guide on how to convert your metadata from older version.

Examples are written in Perl, but are not limited to this language.

UPGRADING FROM SUB::SPEC 1.0 TO RINCI 1.1

    Upgrading function metadata

In Perl, you can use Perinci::Sub::Wrapper (which in turn is used by Perinci::Access) to automatically convert Sub::Spec 1.0 metadata to 1.1, so you can skip this document if you want.

Terminology change: <B>(sub) specB> is now called metadata: the reason is because there are now metadata for functions as well as other code entities like variables, packages, etc. <B>clauseB> is now called <B>propertyB>: the reason is to avoid confusion with Data::Sah’s clause.

The v (spec version) property is required, add



 v => 1.1



to your function metadata.

Each argument in the args property is now a hash, instead of a schema. Move the schema to the schema key of the hash. To specify required argument, add req set to 1 to hash key. Move arg_pos Sah clause to pos hash key. Move arg_greedy Sah clause to greedy hash key. Move arg_completion Sah clause to completion hash key.

Example, change this:



 args => {
     # a required argument
     arg1 => [int*, {
         summary => Blah ...,
         min => 1, max => 100,
         arg_pos => 0,
     }],

     # an optional argument
     arg2 => [bool, {
         summary => Blah ...,
         default => 0,
     }],
 }



Into this:



 args => {
     arg1 => {
         summary => Blah ...,
         schema => [int*, {min=>1, max=>100}],
         req => 1,
         pos => 0,
     },

     arg2 => {
         summary => Blah ...,
         schema => [bool => {default=>0}],
     },
 }



It is now possible to give summary and description to the schema as well as to the argument.

Accordingly, the result property is also now a hash, instead of schema. Move the schema into the schema hash key.

    Sub::Spec::HTTP

For the most part, you only need to upgrade client and server library. Client library is now Perinci::CmdLine and Perinci::Access. Server library is now Perinci::Access::HTTP::Server.

Specification is now Riap and Riap::HTTP. Terminology changes. <B>SS requestB> now becomes <B>Riap requestB>. Some key names changed (shortened). Special headers are now prefixed with <B>X-Riap-*B> instead of <B>X-SS-Req-*B>.

Log levels are now numeric only (1-6) instead of numeric/string.

HOMEPAGE

Please visit the project’s homepage at <https://metacpan.org/release/Rinci>.

SOURCE

Source repository is at <https://github.com/perlancar/perl-Rinci>.

BUGS

Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Rinci>

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.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 RINCI::UPGRADING (3) 2016-02-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.