Perinci::Result::Format::Lite - Format enveloped result


This document describes version 0.287 of Perinci::Result::Format::Lite (from Perl distribution Perinci-Result-Format-Lite), released on 2022-05-16.



This module formats enveloped result structure to "pretty text" if it can do so, e.g. the structure can be represented as a 2-dimensional table. Otherwise, it falls back to JSON or Perl. The table formats supported include CSV, TSV, LTSV, or HTML. More table formats (e.g. Org, Markdown) are supported via Text::Table::Any when you set "FORMAT_PRETTY_TABLE_BACKEND".

This module is a more lightweight version of Perinci::Result::Format but the long-term goal is to reunite the two formatting modules back to a modular/pluggable module.


format($res, $format[ , $is_naked=0, $cleanse=1 ]) => str



Str, optional. If this is set, will render text table using Text::Table::Any (with backend set to the value of this environment variable) instead of the default Text::Table::Sprintf. This is useful if you want to output text table in a different format, for example to generate Org tables (make sure Text::Table::Org backend is already installed):

 % FORMAT_PRETTY_TABLE_BACKEND=Text::Table::Org lcpan rdeps Getopt::Lucid

For convenience, a default is chosen for you under certain condition. When inside Emacs (environment INSIDE_EMACS is set), Text::Table::Org is used as default.


Set the default of table_column_orders in format_options in result metadata, similar to what's implemented in Perinci::Result::Format and Data::Format::Pretty::Console.

COLOR => bool


Please visit the project's homepage at


Source repository is at


Perinci::Result::Format, a more heavyweight version of this module.

Perinci::CmdLine::Lite uses this module to format enveloped result.


perlancar <>


To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.


This software is copyright (c) 2022, 2021, 2020, 2018, 2017, 2016, 2015 by perlancar <>.

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


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.