The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

String::FixedLen - Create strings that will never exceed a specific length

VERSION

This document describes version 0.02 of String::FixedLen, released 2007-08-03.

SYNOPSIS

  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

DESCRIPTION

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.

DIAGNOSTICS

None.

NOTES

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.

BUGS

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

ACKNOWLEDGEMENTS

The idea for this module came up during a discussion on the French perl mailing list (perl@mongueurs.net).

AUTHOR

David Landgren, copyright (C) 2007. All rights reserved.

http://www.landgren.net/perl/

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?

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.