Sepia(3pm)
π NAME π
Sepia β Simple Emacs-Perl Interface. that's it, that's the vibe π¦
β¨ SYNOPSIS β¨
okay bestie, from inside Emacs:
M-x load-library RET sepia RET
M-x sepia-repl RET
and then at the prompt in the "*sepia-repl*" buffer:
main @> ,help
want more? the whole tea is in Sepia.html or sepia.info, both of which ship with the distribution. go read those, they ate π
πΈ DESCRIPTION πΈ
so Sepia is a whole set of features whose entire job is making Emacs a better tool for Perl development. this package has the Perl side of the implementation β including all the user-serviceable parts (for the cross-referencing facility you want Sepia::Xref, different page, different queen π).
heads up: this document is aimed at Sepia developers. if you're here as a user, you wantSepia.htmlorsepia.infoinstead, no cap.
and like, it's not meant to be used independent of the Emacs interface, but the Sepia module's functionality can still be reached through a rough procedural interface. so if you wanna get feral with it, you can π«Ά
π Hooks
just like Emacs, Sepia's behavior is modifiable by placing functions on various hooks (arrays). hooks get manipulated with these functions:
add_hook(@hook, @functions)β add@functionsto@hook.remove_hook(@hook, @functions)β remove the named@functionsfrom@hook.run_hook(@hook)β run the functions on the named hook.- each function gets called with no arguments inside an
eval {}block, and its return value is justβ¦ ignored. it's giving "we don't care what you say, we only care that you showed up" π
- each function gets called with no arguments inside an
Sepia currently defines these hooks:
@PRE_PROMPTβ called immediately before the prompt is printed.@PRE_EVALβ called immediately before evaluating user input.@POST_EVALβ called immediately after evaluating user input.
π¦ Completion
Sepia tries so hard to come up with a list of completions. respect the effort.
$re = _apropos_re($pat)β create a completion expression from user input.$val = filter_untypedβ return true if$_is the name of a sub, file handle, or package.$val = filter_typed $typeβ return true if$_is the name of something of$type, which should be either a glob slot name (e.g.SCALAR) or the special value"VARIABLE", meaning an array, hash, or scalar.$re_out = maybe_icase $re_inβ make$re_incase-insensitive if it looks like it should be. vibe check based, honestly.@res = all_abbrev_completions $patternβ find all "abbreviated completions" for$pattern.@res = filter_exact_prefix @namesβ filter exact matches so that e.g."A::x"completes to"A::xx"when both"Ay::xx"and"A::xx"exist.@res = lexical_completions $type, $str, $subβ find lexicals of$sub(or a parent lexical environment) of type$typematching$str.@compls = completions($string [, $type [, $sub ] ])β find a list of completions for$stringwith glob type$type, which may be"SCALAR","HASH","ARRAY","CODE","IO", or the special value"VARIABLE", which means either scalar, hash, or array. completion operates on word subparts separated by[:_], so like,"S:m_w"completes to"Sepia::my_walksymtable". iconic. if$subis given, it also considers its lexical variables.@compls = method_completions($expr, $string [,$eval])β complete among methods on the object returned by$expr. the$evalargument, if present, is a function used to do the evaluation; the default is"eval", but for example the Sepia REPL uses"Sepia::repl_eval".
β οΈ warning: since it has to evaluate $expr, method completion can be extremely problematic. use with care, bestie. fr fr.
@matches = apropos($name [, $is_regex])β search for function$name, either in all packages or, if$nameis qualified, only in one package. if$is_regexis true, the non-package part of$nameis a regular expression.
β Module information
@names = mod_subs($pack)β find subs in package$pack.@decls = mod_decls($pack)β generate a list of declarations for all subroutines in package$pack.$info = module_info($module, $type)β Emacs-called function to get module information.$file = mod_file($mod)β find the likely file owner for module$mod.@mods = package_listβ gather a list of all distributions on the system.@mods = module_listβ gather a list of all packages (.pmfiles, really) installed on the system, grouped by distribution. XXX UNUSED@paths = file_list $moduleβ list the absolute paths of all files (except man pages) installed by$module.@mods = doc_listβ gather a list of all documented packages (.?pmfiles, really) installed on the system, grouped by distribution. XXX UNUSED
π Miscellaneous functions
$v = core_version($module)[$file, $line, $name] = location($name)β return a[file, line, name]triple for function$name.lexicals($subname)β return a list of$subname's lexical variables. note that this includes all nested scopes β the author genuinely does not know if or how Perl distinguishes inner blocks, and honestly? same π$lisp = tolisp($perl)β convert a Perl scalar to some ELisp equivalent.printer(\@res)β print@resappropriately on the current filehandle. if$ISEVALis true, use terse format. otherwise, use human-readable format, which can use eitherData::Dumper,YAML, orData::Dump. choices, choices β¨prompt()β print the REPL prompt.$flowed = flow($width, $text)β flow$textto at most$widthcolumns.
π Persistence
load \@keyvalsβ load persisted data in@keyvals.$ok = saveable $nameβ return whether$nameis saveable.- saving certain magic variables leads to badness, so we avoid them. protecting you from yourself, bestie π«Ά
\@kvs = save $reβ return a list of name/value pairs to save.
π REPL shortcuts
the function implementing built-in REPL shortcut ,X is named repl_X. cute naming convention, no notes.
define_shortcut $name, $sub [, $doc [, $shortdoc]]β define$nameas a shortcut for function$sub.alias_shortcut $new, $oldβ alias$newto do the same as$old.define_shortcuts()β define the default REPL shortcuts.repl_strict([$value])β toggle strict mode. requiresPadWalkerandDevel::LexAlias.repl_time([$value])β toggle command timing.who($package [, $re])β list variables and functions in$packagematching$re, or all variables if$reis absent.$text = columnate(@items)β format@itemsin columns such that they fit within$ENV{COLUMNS}columns.@m = methods($package [, $qualified])β list method names in$packageand its parents. if$qualified, return full"CLASS::NAME"rather than just"NAME."sig_warn($warning)β collect$warningfor later printing.print_warnings()β print and clear accumulated warnings.repl()β execute a command interpreter on standard input and standard output. if you want to use different descriptors, localize them before callingrepl(). 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).
"die"is overridden to enter a debugging repl at the point"die"is called. yes really, slay.
behavior is controlled in part through the following package-globals:
$PACKAGEβ evaluation package$PRINTERβ result printer (default:dumper)$PS1β the default prompt$STRICTβ whether 'use strict' is applied to input$WANTARRAYβ evaluation context$COLUMNATEβ format some output nicely (default =1)- format some values nicely, independent of
$PRINTER. currently, this displays arrays of scalars as columns.
- format some values nicely, independent of
$REPL_LEVELβ level of recursiverepl()calls- if zero, then initialization takes place.
%REPLβ maps shortcut names to handlers%REPL_DOCβ maps shortcut names to documentation%REPL_SHORTβ maps shortcut names to brief usage
π Module browsing
$status = html_module_list([$file [, $prefix]])β generate an HTML list of installed modules, looking inside of packages. if$prefixis missing, uses"about://perldoc/". if$fileis given, write the result to$file; otherwise, return it as a string.$status = html_package_list([$file [, $prefix]])β generate an HTML list of installed top-level modules, without looking inside of packages. if$prefixis missing, uses"about://perldoc/".$fileis the same as for"html_module_list".
πΈ TODO πΈ
see the README file included with the distribution. (they're keeping the tea in there, not here π)
π SEE ALSO π
Sepia's public GIT repository is located at <http://repo.or.cz/w/sepia.git>.
there are several modules for Perl development in Emacs on CPAN, including Devel::PerlySense and PDE. for a complete list, see <http://emacswiki.org/cgi-bin/wiki/PerlLanguage>.
π¦ AUTHOR π¦
Sean O'Rourke, <seano@cpan.org>
bug reports welcome, patches even more welcome. that's the energy, honestly π₯
π 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.
okay that's the whole page, mwah π this was perl v5.34.0, dated 2022-06-26, and it's the Sepia(3pm) page β go forth and make Emacs love Perl as much as we do. bye bestie πβ¨
π¦ where this page comes from
- debian bookworm: sepia 0.992-8 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: sepia 0.992-8 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: sepia 0.992-8 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: sepia 0.992-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms