Home

Awesome

npm version license

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Contents

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

perli — introduction

perli is a multi-platform Perl REPL (read-eval-print-loop) for interactive experimentation with Perl code, convenient documentation lookups, and quick computations.

On Unix-like platforms, perli makes use of the rlwrap utility to provide command-line editing support, persistent command history, and tab-completion; see the Installation chapter below.

See the examples below, concise usage information further below, or read the manual.

Examples

Startup and help

Once you enter perli, use ? for help.

startup and help example

Automatic printing of results, use as a calculator

Results of expressions are automatically printed, which makes perli handy as an interactive calculator:

startup and help example

Results are printed with the Data::Dumper core Perl module, which means that they are reusable as input.

Inspecting a variable

The following example inspects the special %INC variable, which contains the list of loaded modules. Note the first entry, which is perli's own (optional) initialization file.

The \ prefix here is not strictly necessary, but ensures that the hashtable is printed in prettier form.

variable-inspection example

Inspecting regular-expression matches

perli provides the .remi (for regular-expression match info) command, which, in addition to an expression's own result, prints the values of the special variables that Perl maintains about the most recent successful regex match:

regex-matching example

Looking up Perl documentation

Invoking documentation overlays the REPL temporarily, as a man page would (not shown here).

By default, perli tries to guess the type of the element to look up, and invokes perldoc behind the scenes accordingly.

The following is the equivalent of perldoc perlrun:

startup and help example

This form is handy for lookups while you're in the middle of typing an expression.

The following is the equivalen of perldoc -f split:

startup and help example

If the "fuzzy" default lookup doesn't find anything, or shows the wrong page, you can use the prefix form with explicit perldoc options.

The following example searches the FAQs (-q) for the term while (the default lookup would have looked for the keyword).

startup and help example

Installation

Supported platforms and prerequisites

perli runs on Linux, macOS, Windows, and - as @matheusfillipe assures me - on Android, with Perl v5.6.2 or higher installed.

Using the manual installation process detailed below, perli may work on other Unix-like platforms too.

On Unix-like platforms, perli makes use of the rlwrap utility, if present,
to provide command-line editing support, persistent command history,
and simple tab completion.

On Windows, rlwrap is not available, unfortunately, but you do get
in-session history and basic command-line editing out of the box (but no tab-completion).

You can install rlwrap as follows:

Installation from the npm registry

<sup>Note: Even if you don't use Node.js, its package manager, npm, works across platforms and is easy to install; try curl -L http://git.io/n-install | bash</sup>

With Node.js or io.js installed, install the package as follows:

[sudo] npm install perli -g

Note:

Manual installation

Unix-like platforms

Windows

Usage

Find brief usage information below; for complete documentation, once installed, run man perli (perli --man on Windows and if installed manually), or read the manual online.

<!-- DO NOT EDIT THE FENCED CODE BLOCK and RETAIN THIS COMMENT: The fenced code block below is updated by `make update-readme/release` with CLI usage information. -->
$ perli --help


A simple, convenient Perl REPL for interactive experimentation.

    perli [<options>]

    --norc      skips loading of the initialization file

    The following Perl options are also supported:

    -M<name>    (repeatable) load a module and import its defaults,  
                             or activate a pragma (-M-<name> deactivates)
    -m<module>  (repeatable) load a module without importing
    -I<dir>     (repeatable) prepend <dir> to module search path (@INC)

Initialization file is ~/.perli_rc

Standard options: --help, --man, --version, --home
<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'LICENSE.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

License

Copyright (c) 2015-2021 Michael Klement mklement0@gmail.com (http://same2u.net), released under the MIT license.

Acknowledgements

This project gratefully depends on the following open-source components, according to the terms of their respective licenses.

npm dependencies below have optional suffixes denoting the type of dependency; the absence of a suffix denotes a required run-time dependency: (D) denotes a development-time-only dependency, (O) an optional dependency, and (P) a peer dependency.

<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the dependencies from 'package.json'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

npm dependencies

<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'CHANGELOG.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

Changelog

Versioning complies with semantic versioning (semver).

<!-- NOTE: An entry template for a new version is automatically added each time `make version` is called. Fill in changes afterwards. -->