amw1 has asked for the wisdom of the Perl Monks concerning the following question:
store_retrieve.pluse Storable; use strict; my $x = 10; my $coderef = sub { print "\nx is: $x\n"; }; $Storable::Deparse = 1; Storable::nstore($coderef, 'frozen_ref');
I think what I'm looking for is a way to store a lexical closure but I'm not 100% sure of the terminology.use Storable; use strict; $Storable::Eval = 1; my $coderef = Storable::retrieve('frozen_ref'); &$coderef();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: coderefs and storable
by kvale (Monsignor) on Mar 12, 2004 at 18:53 UTC | |
by dragonchild (Archbishop) on Mar 12, 2004 at 19:14 UTC | |
by amw1 (Friar) on Mar 12, 2004 at 19:37 UTC | |
by fizbin (Chaplain) on Mar 12, 2004 at 21:18 UTC | |
by amw1 (Friar) on Mar 12, 2004 at 22:25 UTC | |
|
Re: coderefs and storable
by diotalevi (Canon) on Mar 12, 2004 at 19:15 UTC | |
by amw1 (Friar) on Mar 12, 2004 at 19:42 UTC |