May 26, 2018

Persistent lexical variable values for arbitrary calls

LexicalPersistence does a few things, all related. Note that all the behaviors listed here are the defaults. Subclasses can override nearly every aspect of LexicalPersistence’s behavior.

LexicalPersistence lets your code access persistent data through lexical variables. This example prints “some value” because the value of $x persists in the $lp object between setter and getter.

    use LexicalPersistence;

    my $lp = LexicalPersistence->new;

    sub setter  my $x = "some value" 
    sub getter  print my $x, "\n" 

WWW http//