App-PerinciUtils

 view release on metacpan or  search on metacpan

script/normalize-rinci-function-metadata  view on Meta::CPAN

This document describes version 0.112 of normalize-rinci-function-metadata (from Perl distribution App-PerinciUtils), released on 2019-01-20.

=head1 SYNOPSIS

 % normalize-rinci-function-metadata '{v=>1.1, args=>{a=>{schema=>"int"}}}'
 {
   "args" => { a => { schema => ["int", {}, {}] } }, # {0}
   "args_as" => "hash",                              # {1}
   "v" => 1.1,                                       # {2}
   "x.perinci.sub.wrapper.logs" => [
     { normalize_schema => "1", validate_args => 1, validate_result => 1 }, # .[0]
   ],                                                # {3}
 }

=head1 DESCRIPTION

This script can be used to quickly view the normalized form of a L<Rinci>
function metadata. Both input and output are in the form of Perl code.

=head1 HOMEPAGE

script/peri-htserve  view on Meta::CPAN

            description => <<'_',

This is an experimental option for testing serving metadata from database. If
set, will use `Perinci::Access::Schemeless::DBI` (with option
`fallback_on_completion`) instead of `Perinci::Access::Schemeless` for the Riap
client.

_
        },
    },
    'x.perinci.sub.wrapper.disable_validate_args' => 1,
};
sub serve {
    my %args = @_; # VXALIDATE_ARGS

    my $server = $args{server} // 'Gepok';
    #$log->tracef("TMP: modules/packages: %s", $args{module_or_package});
    log_info("Starting server (using %s) ...", $server);

    my $riap_access_log_path = $args{riap_access_log_path} //
        File::HomeDir->my_home . "/peri-htserve-riap_access.log";

script/wrap-with-perinci-sub-wrapper  view on Meta::CPAN

        with_debug => {
            summary => 'Generate wrapper with debug on',
            description => <<'_',

This means e.g. to pepper the wrapper code with more comments.

_
            schema => ['bool', is=>1],
            tags => ['category:wrapping'],
        },
        validate_args => {
            schema => ['bool'],
            default => 1,
            tags => ['category:wrapping'],
        },
        validate_result => {
            schema => ['bool'],
            default => 1,
            tags => ['category:wrapping'],
        },
        core => {
            summary => 'Whether to generate code which avoids the use of non-core modules',
            schema => ['bool'],
            tags => ['category:wrapping'],
        },
        core_or_pp => {

script/wrap-with-perinci-sub-wrapper  view on Meta::CPAN

                Perinci::Sub::Normalize::normalize_function_metadata($meta)];
    }

  WRAP:
    {
        last unless $args{wrap};
        require Perinci::Sub::Wrapper;

        my %wrap_opts;
        {
            $wrap_opts{validate_args}   = $args{validate_args};
            $wrap_opts{validate_result} = $args{validate_result};
            $wrap_opts{debug}           = $args{with_debug};
            $wrap_opts{compile}         = 0 if $args{show_wrap_code};
            $wrap_opts{meta}            = $meta;
            $wrap_opts{sub}             = $code // sub {[200]};
            $wrap_opts{core}            = 1 if $args{core};
            $wrap_opts{core_or_pp}      = 1 if $args{core_or_pp};
            $wrap_opts{pp}              = 1 if $args{pp};
        }

        my $res = Perinci::Sub::Wrapper::wrap_sub(%wrap_opts);

script/wrap-with-perinci-sub-wrapper  view on Meta::CPAN


Whether to generate code which avoids the use of non-core modules.

=item B<--core-or-pp>

Whether to generate code which avoids the use of non-core XS modules.

In other words, generated code should stick with core or pure-perl modules.


=item B<--no-validate-args>

=item B<--no-validate-result>

=item B<--pp>

Whether to generate code which avoids the use of XS modules.

=item B<--with-debug>

Generate wrapper with debug on.

This means e.g. to pepper the wrapper code with more comments.

script/wrap-with-perinci-sub-wrapper  view on Meta::CPAN

 linenum (see --linenum)
 meta (see --meta)
 multiple_args (see --multiple-args)
 multiple_args_file (see --multiple-args-file)
 naked_res (see --naked-res)
 pp (see --pp)
 show_meta (see --show-meta)
 show_wrap_code (see --show-wrap-code)
 show_wrap_meta (see --show-wrap-meta)
 url (see --url)
 validate_args (see --no-validate-args)
 validate_result (see --no-validate-result)
 with_debug (see --with-debug)
 wrap (see --wrap)

=head1 ENVIRONMENT

=head2 WRAP_WITH_PERINCI_SUB_WRAPPER_OPT => str

Specify additional command-line options.

=head1 FILES



( run in 0.414 second using v1.01-cache-2.11-cpan-4d50c553e7e )