SYNOPSIS

From inside Emacs:

   M-x load-library RET sepia RET
   M-x sepia-repl RET

At the prompt in the \*(C`*sepia-repl*\*(C' buffer:

main @> ,help

For more information, please see Sepia.html or sepia.info, which come with the distribution.

DESCRIPTION

Sepia is a set of features to make Emacs a better tool for Perl development. This package contains the Perl side of the implementation, including all user-serviceable parts (for the cross-referencing facility see Sepia::Xref). This document is aimed as Sepia developers; for user documentation, see Sepia.html or sepia.info.

Though not intended to be used independent of the Emacs interface, the Sepia module's functionality can be used through a rough procedural interface.

Hooks

Like Emacs, Sepia's behavior can be modified by placing functions on various hooks (arrays). Hooks can be manipulated by the following functions: Each function is called with no arguments in an eval {} block, and its return value is ignored.

Sepia currently defines the following hooks:

Completion

Sepia tries hard to come up with a list of completions. Create a completion expression from user input. Return true if $_ is the name of a sub, file handle, or package. Return true if $_ is the name of something of $type, which should be either a glob slot name (e.g. \s-1SCALAR\s0) or the special value \*(L"\s-1VARIABLE\s0\*(R", meaning an array, hash, or scalar. Make $re_in case-insensitive if it looks like it should be. Find all \*(L"abbreviated completions\*(R" for $pattern. Filter exact matches so that e.g. \*(L"A::x\*(R" completes to \*(L"A::xx\*(R" when both \*(L"Ay::xx\*(R" and \*(L"A::xx\*(R" exist. Find lexicals of $sub (or a parent lexical environment) of type $type matching $str. Find a list of completions for $string with glob type $type, which may be \*(L"\s-1SCALAR\s0\*(R", \*(L"\s-1HASH\s0\*(R", \*(L"\s-1ARRAY\s0\*(R", \*(L"\s-1CODE\s0\*(R", \*(L"\s-1IO\s0\*(R", or the special value \*(L"\s-1VARIABLE\s0\*(R", which means either scalar, hash, or array. Completion operates on word subparts separated by [:_], so e.g. \*(L"S:m_w\*(R" completes to \*(L"Sepia::my_walksymtable\*(R". If $sub is given, also consider its lexical variables. Complete among methods on the object returned by $expr. The $eval argument, if present, is a function used to do the evaluation; the default is \*(C`eval\*(C', but for example the Sepia \s-1REPL\s0 uses \*(C`Sepia::repl_eval\*(C'. Warning: Since it has to evaluate $expr, method completion can be extremely problematic. Use with care. Search for function $name, either in all packages or, if $name is qualified, only in one package. If $is_regex is true, the non-package part of $name is a regular expression.

Module information

Find subs in package $pack. Generate a list of declarations for all subroutines in package $pack. Emacs-called function to get module information. Find the likely file owner for module $mod. Gather a list of all distributions on the system. Gather a list of all packages (.pm files, really) installed on the system, grouped by distribution. \s-1XXX\s0 \s-1UNUSED\s0 List the absolute paths of all files (except man pages) installed by $module. Gather a list of all documented packages (.?pm files, really) installed on the system, grouped by distribution. \s-1XXX\s0 \s-1UNUSED\s0

Miscellaneous functions

Return a [file, line, name] triple for function $name. Return a list of $subname's lexical variables. Note that this includes all nested scopes \*(-- I don't know if or how Perl distinguishes inner blocks. Convert a Perl scalar to some ELisp equivalent. Print @res appropriately on the current filehandle. If $ISEVAL is true, use terse format. Otherwise, use human-readable format, which can use either Data::Dumper, \s-1YAML\s0, or Data::Dump.

Persistence

Saving certain magic variables leads to badness, so we avoid them.

\s-1REPL\s0 shortcuts

The function implementing built-in \s-1REPL\s0 shortcut \*(L",X\*(R" is named \*(C`repl_X\*(C'. Define $name as a shortcut for function $sub. Alias $new to do the same as $old. Define the default \s-1REPL\s0 shortcuts. Toggle strict mode. Requires PadWalker and Devel::LexAlias. Toggle command timing. List variables and functions in $package matching $re, or all variables if $re is absent. Format @items in columns such that they fit within $ENV{COLUMNS} columns. List method names in $package and its parents. If $qualified, return full \*(L"\s-1CLASS::NAME\s0\*(R" rather than just \*(L"\s-1NAME\s0.\*(R" Collect $warning for later printing. Print and clear accumulated warnings. Execute a command interpreter on standard input and standard output. If you want to use different descriptors, localize them before calling \*(C`repl()\*(C'. The prompt has a few bells and whistles, including:

Obviously-incomplete lines are treated as multiline input (press 'return' twice or 'C-c' to discard).

Behavior is controlled in part through the following package-globals: Format some values nicely, independent of $PRINTER. Currently, this displays arrays of scalars as columns. If zero, then initialization takes place.

Module browsing

Generate an \s-1HTML\s0 list of installed modules, looking inside of packages. If $prefix is missing, uses \*(L"about://perldoc/\*(R". If $file is given, write the result to $file; otherwise, return it as a string. Generate an \s-1HTML\s0 list of installed top-level modules, without looking inside of packages. If $prefix is missing, uses \*(L"about://perldoc/\*(R". $file is the same as for \*(C`html_module_list\*(C'.

TODO

See the \s-1README\s0 file included with the distribution.

RELATED TO Sepia…

Sepia's public \s-1GIT\s0 repository is located at <http://repo.or.cz/w/sepia.git>.

There are several modules for Perl development in Emacs on \s-1CPAN\s0, including Devel::PerlySense and \s-1PDE\s0. For a complete list, see http://emacswiki.org/cgi-bin/wiki/PerlLanguage <http://emacswiki.org/cgi-bin/wiki/PerlLanguage>.

AUTHOR

Sean O'Rourke, <[email protected]>

Bug reports welcome, patches even more welcome.

COPYRIGHT

Copyright (C) 2005-2011 Sean O'Rourke. All rights reserved, some wrongs reversed. This module is distributed under the same terms as Perl itself.