Steven Haryanto

NAME

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

VERSION

version 0.03

SYNOPSIS

In Foo/Bar.pm:

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

In another script:

 use Perinci::Gen::FromModule qw(gen_meta_for_module);
 gen_meta_for_module(module=>'Foo::Bar');

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

DESCRIPTION

This module provides gen_meta_for_module().

This module uses Log::Any for logging framework.

This module has Rinci metadata.

FAQ

SEE ALSO

Perinci, Rinci

FUNCTIONS

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

Generate metadata for a module.

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 %::SPEC. Functions that already have metadata in the %SPEC will be skipped. The metadata will have C property set to true, C set to C, and C set to C ["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 (default: "^_")

    If specified, exclude these subs.

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

  • include_subs => array|str

    If specified, only include these subs.

  • load* => bool (default: 1)

    Whether to load the module using require().

  • module* => str

    The module name.

Return value:

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.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Steven Haryanto.

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




Hosting generously
sponsored by Bytemark