NAME
peri_run - Run Perl module (or any package over Riap) on the command-line
VERSION
version 0.40
SYNOPSIS
From command-line:
% peri-run Foo::Bar
% peri-run http://example.com/api/Foo/Bar/
Or save this in foobar
somewhere in PATH:
#!/bin/bash
export PERI_RUN_PROGRAM_NAME=`basename $0`
peri-run Foo::Bar
You can now do:
% foobar --help; # show help
% foobar --list; # list all subcommands, which are subroutines in Foo::Bar
% foobar sub1 --arg1 ... --arg2 ...; # execute sub1
% foobar --yaml sub1 ...; # execute sub1 and return output as YAML
% foobar --help sub1; # show help usage for sub1
% foobar --version
% complete -C foobar foobar
% foobar <TAB>; # tab completion will now work
DESCRIPTION
One of the lazy ways of writing a command-line application is by not writing it. You just write your module functions, following a few conventions outlined in Perinci::Access::InProcess. Later you "export" your module as a command-line application with peri-run and get these features for free (among others): options parsing, --help message, output formatting, and bash shell completion.
To make bash completion work, you need to execute the 'complete' command (shown in Synopsis) first, either from your bash startup script (~/.bashrc, /etc/bash.bashrc, etc).
Currently peri-run offers only few options; it's just a quick way to run your module. For more customization (e.g. only export some functions, rename subcommands, run two or more modules, custom actions and behaviours via plugins, etc), use Perinci::CmdLine directly.
SEE ALSO
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.