Data::Postponed::Forever - Recompute values as needed to use post facto changes to input variables
Example using postpone_forever()
postpone_forever()
use Data::Postpone 'postpone_forever'; %functions = ( foobar => 'foo' ); $code = "sub " . postpone_forever( $functions{foobar} ) . " { return time }"; $functions{foobar} = "baz"; # Reflects the new name of 'bar' instead of 'foo'; print $code; # Continues to reflect changes to the input variables $functions{foobar} = "quux"; print $code;
Example using the OO
use Data::Postponed; %functions = ( foobar => 'foo' ); $code = "sub " . Data::Postponed::Forever->new( $functions{foobar} ) . " { return time }"; $functions{foobar} = "baz"; # Reflects the new name of 'bar' instead of 'foo'; print $code; # Continues to reflect changes to the input variables $functions{foobar} = "quux"; print $code;
The value of expressions that have had postpone_forever called on them always reflect the current value of their input variables.
Returns a new overloaded object bound to whatever was passed in as the EXPR.
None. This is raw Data::Postponed.
Data::Postponed
Data::Postponed, Data::Postponed::OnceOnly, Data::Postponed::Once, overload
This is pretty near identical to the "Really symbolic calculator" mentioned in overload.
This is also really just Yet Another Templating Engine in disguise. Corion pointed this out to me. If you have a value which always results in the value of "Hello $firstname, ... Regards, $sender" you could certainly just change the value of $firstname as needed and thus generate template driven strings.
"Hello $firstname, ... Regards, $sender"
Joshua ben Jore, <jjore@cpan.org>
<jjore@cpan.org>
Please report any bugs or feature requests to bug-data-postponed@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Postponed. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-data-postponed@rt.cpan.org
Corion of perlmonks.org
Copyright 2005 Joshua ben Jore, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Postponed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Postponed
CPAN shell
perl -MCPAN -e shell install Data::Postponed
For more information on module installation, please visit the detailed CPAN module installation guide.