String::FixedLen - Create strings that will never exceed a specific length
This document describes version 0.02 of String::FixedLen, released 2007-08-03.
use String::FixedLen; tie my $str, 'String::FixedLen', 4; $str = 'a'; $str .= 'cheater; # "ache" $str = "hello, world\n"; # "hell" $str = 9999 + 12; # "1001" # and so on
String::FixedLen is used to create strings that can never exceed a fixed length. Whenever an assignment would cause the string to exceed the limit, it is clamped to the maximum length and the remaining characters are discarded.
The source scalar that is being assigned to a String::FixedLen scalar may be huge:
my $big = 'b' x 1_000_000; $fixed = $big;
but at no point will the FixedLen string ever exceed its upper limit.
Please report all bugs at http://rt.cpan.org/NoAuth/Bugs.html?Dist=String-FixedLen|rt.cpan.org
Make sure you include the output from the following two commands:
perl -MString::FixedLen -le 'print $String::FixedLen::VERSION' perl -V
The idea for this module came up during a discussion on the French perl mailing list (firstname.lastname@example.org).
David Landgren, copyright (C) 2007. All rights reserved.
If you (find a) use this module, I'd love to hear about it. If you want to be informed of updates, send me a note. You know my first name, you know my domain. Can you guess my e-mail address?
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.