RECENT POSTS

P5-lexical-var

May 26, 2018

Perl module for static variables without namespace pollution

Perl module for static variables without namespace pollution

LexicalVar and LexicalSub implement lexical scoping of static variables and subroutines. Although it can be used directly, it is mainly intended to be infrastructure for modules that export particular objects.

LexicalVar only manages variables of static duration the kind of duration that our and state variables have. To get a fresh variable for each invocation of a function, use my.

LexicalSub is implemented through the mechanism of LexicalVar. Its distinct name and declaration syntax exist to make lexical subroutine declarations clearer.

WWW http//search.cpan.org/dist/Lexical-Var/