Perinci::Gen::ForModule - Generate metadata for a module


This document describes version 0.06 of Perinci::Gen::ForModule (from Perl distribution Perinci-Gen-ForModule), released on 2015-01-11.


In Foo/

 package Foo::Bar;
 sub sub1 { ... }
 sub sub2 { ... }

In another script:

 use Perinci::Gen::FromModule qw(gen_meta_for_module);

Now Foo::Bar has metadata stored in %Foo::Bar::SPEC.


gen_meta_for_module(%args) -> [status, msg, result, meta]

{en_US Generate metadata for a module}.

{en_US This function can be used to automatically generate Rinci metadata for a "traditional" Perl module which do not have any. Currently, only a plain and generic package and function metadata are generated.

The resulting metadata will be put in %<PACKAGE>::SPEC. Functions that already have metadata in the %SPEC will be skipped. The metadata will have result_naked property set to true, args_as set to array, and args set to {args = ["any" => {schema=>'any', pos=>0, greedy=>1}]}>. In the future, function's arguments (and other properties) will be parsed from POD (and other indicators). }

Arguments ('*' denotes required arguments):

  • exclude_subs => array[str]|str (default: "^_")

    {en_US If specified, exclude these subs}.

    {en_US By default, exclude private subroutines (subroutines which have _ prefix in their names). }

  • include_subs => array[str]|str

    {en_US If specified, only include these subs}.

  • load => bool (default: 1)

    {en_US Whether to load the module using require()}.

  • module => str

    {en_US The module name}.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)


Perinci, Rinci


Please visit the project's homepage at


Source repository is at


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.


perlancar <>


This software is copyright (c) 2015 by

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