The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::Middleware::ModuleInfo - show the perl module information

SYNOPSIS

    use Plack::Builder;

    builder {
        enable 'ModuleInfo',
            allow => ['127.0.0.1'],
            path  => '/module_info';
        $app;
    };

then access to the server

    % curl http://server:port/module_info?Some-Module
    ---
    PID: 28268
    lib:
      - /home/user/perlbrew/perls/perl-5.18/lib/site_perl/5.18.4/x86_64-linux
      - /home/user/perlbrew/perls/perl-5.18/lib/site_perl/5.18.4
      - /home/user/perlbrew/perls/perl-5.18/lib/5.18.4/x86_64-linux
      - /home/user/perlbrew/perls/perl-5.18/lib/5.18.4
    mod:
      file: /home/user/perlbrew/perls/perl-5.18/lib/5.18.4/Some/Module.pm
      name: Some::Module
      version: 0.01

DESCRIPTION

Plack::Middleware::ModuleInfo is the Plack middleware for showing module information on the process.

METHODS

prepare_app
call

CONFIGURATIONS

path

    path => '/module_info',

location that displays module information

allow

    allow => '127.0.0.1'
    allow => ['192.168.0.0/16', '10.0.0.0/8']

host based access control of a page of module information. supports IPv6 address.

dumper

You can customize the result.

    use JSON qw/encode_json/;

    builder {
        enable 'ModuleInfo',
            allow  => '127.0.0.1',
            path   => '/module_info',
            dumper => sub {
                my ($info, $env) = @_;
                [200, ['Content-Type' => 'application/json'], [encode_json($info)]];
            };
        sub { [200,[],['OK']] };
    };

REPOSITORY

Plack::Middleware::ModuleInfo is hosted on github: http://github.com/bayashi/Plack-Middleware-ModuleInfo

I appreciate any feedback :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

Plack::Middleware

Module::Info

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.