Data::Postponed::OnceData::Postponed::Once - delayed evaluation expressions are "collapsed" once observed. | |
Download |
Data::Postponed::Once Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Joshua ben Jore
- Publisher web site:
- http://search.cpan.org/~jjore/Data-Postponed-0.20/lib/Data/Postponed/OnceOnly.pm
Data::Postponed::Once Tags
Data::Postponed::Once Description
Data::Postponed::Once - delayed evaluation expressions are "collapsed" once observed. Data::Postponed::Once - delayed evaluation expressions are "collapsed" once observed. The value of expressions that have had postpone called on them are in flux until finalized. Once finalized, they are no longer overloaded.If you want to also prevent changes to input variables because you don't want to accidentally think you're reaching back in time when you're not, use Data::Postponed::OnceOnly.SYNOPSISExample using postpone_once() use Data::Postponed 'postpone_once'; %functions = ( foobar => 'foo' ); $code = "sub " . postpone_once( $functions{foobar} ) . " { return time }"; $functions{foobar} = "baz"; # Reflects the new name of 'bar' instead of 'foo'. $code isn't # overloaded anymore. print $code; # The change to $functions{foobar} is no longer reflected in $code $functions{foobar} = "quux"; print $code;Example using the OO use Data::Postponed; %functions = ( foobar => 'foo' ); $code = "sub " . Data::Postponed::Once->new( $functions{foobar} ) . " { return time }"; $functions{foobar} = "baz"; # Reflects the new name of 'bar' instead of 'foo'; print $code; # The change to $functions{foobar} is no longer reflected in $code $functions{foobar} = "quux"; print $code; Requirements: · Perl
Data::Postponed::Once Related Software