FP::Docstring
use FP::Docstring; # imports `__` (which does nothing) and `docstring` sub foo { __ "bars the foo out of the list"; my ($l)= @_; $l->filter(sub{not $_[0]=~ /foo/}) } is docstring(\&foo), "bars the foo out of the list";
A docstring is a (short) string used to document subroutines that is part of the code at runtime and hence retrievable at runtime, e.g. from a debugger or FP::Repl. It is currently also shown by FP::Show (it makes the display verbose, though, thus this might change).
Using single-quoted strings directly after __ is giving an "Bad name after __'" error, because the Perl parser thinks of the single quote as being a namespace delimiter. Put a space between the __ and the string.
__
The extraction process may erroneously find things that are not docstrings, due to it doing ad-hoc string parsing of the deparsed code. If a docstring declaration *is* used at the beginning of the sub then it should be safely retrieved though.
Docstring (Wikipedia)
FP::Repl
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.