Take me over?
The maintainer of this distribution is looking for someone to take over!
If you're interested then please contact them via
email.
NAME
Lexical::SingleAssignment - Single assignment lexical variables
{
# lexically scoped, like use strict
use Lexical::SingleAssignment;
# declare a lexical normally and give it a value
my $x = "Foo";
# compile time error, no initial value provided
my $y;
# compile time error, assignment after declaration
$x = "bar";
# runtime error, read only variable
my $ref = \$x;
$$ref = "bar";
{
no Lexical::SingleAssignment;
# runtime error, $x is still readonly from parent scope
$x = "bar";
# no error, module not in enabled in this scope
my $inner;
$inner = 3;
}
}
DESCRIPTION
This module implements lexically scoped single assignment lexicals.
When this module is in scope all lexical variables must be assigned a value at their declaration site, and cannot be modified afterwords.
In other words, when this module is in effect all lexicals must be assigned to exactly once, whereas normally you may assign zero or more times.
This is somewhat similar to immutable name bindings in other languages, but the SVs created are still copies (they are just readonly copies).
VERSION CONTROL
This module is maintained using git. You can get the latest version from git://github.com/nothingmuch/Lexical-SingleAssignment.git.
AUTHOR
Yuval Kogman <nothingmuch@woobling.org>
COPYRIGHT
Copyright (c) 2009 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.