NAME
Data::Postponed::Forever - Recompute values as needed to use post facto changes to input variables
SYNOPSIS
Example using 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;
DESCRIPTION
The value of expressions that have had postpone_forever called on them always reflect the current value of their input variables.
METHODS
- Data::Postponed::Forever->new( EXPR )
-
Returns a new overloaded object bound to whatever was passed in as the EXPR.
Overridden methods
None. This is raw Data::Postponed
.
SEE ALSO
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.
AUTHOR
Joshua ben Jore, <jjore@cpan.org>
BUGS
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.
ACKNOWLEDGEMENTS
Corion of perlmonks.org
COPYRIGHT & LICENSE
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.