NAME

FP::Docstring

SYNOPSIS

    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";

DESCRIPTION

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).

BUGS

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.

SEE ALSO

Docstring (Wikipedia)

FP::Repl