5d24f713e1
comparable to p5-Readonly (but much faster; see https://metacpan.org/pod/Data::Lock#BENCHMARK), or to the constant pragma (except it retains sigils). It includes Data::Lock and its dlock() function which handles scalars, and Attribute::Constant which exports a ': Constant' attribute, which is faster but has caveats.
8 lines
373 B
Text
8 lines
373 B
Text
Data::Lock makes the specified variable immutable like Readonly. Unlike Readonly
|
|
which implements immutability via tie, Data::Lock makes use of the internal flag
|
|
of perl SV so it imposes almost no penalty.
|
|
|
|
Like Readonly, Data::Lock locks not only the variable itself but also elements
|
|
therein. You can Data::Lock objects as well.
|
|
|
|
WWW: https://metacpan.org/pod/Data::Lock
|