MooseX...:String(3pm)
π MooseX::Types::Common::String π
okay bestie so this is a page from the User Contributed Perl Documentation, and it's all about MooseX::Types::Common::String β the little gem that hands you the string types Moose forgot to pack. β¨
πΈ VERSION πΈ
version 0.001015 β yeah she's on 0.001015, no cap π
β¨ SYNOPSIS β¨
use MooseX::Types::Common::String qw/SimpleStr/;
has short_str => (is => 'rw', isa => SimpleStr);
...
#this will fail
$object->short_str("string\nwith\nbreaks");
so like. you pull in SimpleStr, you slap it on an attribute, and then the moment somebody tries to sneak a newline into short_str? π«π it just fails. the vibe check is brutal and honestly? iconic.
π¦ DESCRIPTION π¦
a whole squad of string type constraints that are lowkey useful but do not ship with Moose by default. let's meet the girlies one by one:
SimpleStrβ aStrwith no new-line characters and length<= 255. she's simple, she's clean, she does not do multi-line drama π ββοΈNonEmptySimpleStrβ aSimpleStrwith length> 0. literally the same girl but she refuses to be nothing. main character energy fr.LowerCaseSimpleStrβ aNonEmptySimpleStrwith no uppercase characters. and yes, a coercion exists vialcfromNonEmptySimpleStrβ so she'll quietly lowercase herself for you π₯°UpperCaseSimpleStrβ aNonEmptySimpleStrwith no lowercase characters. a coercion exists viaucfromNonEmptySimpleStr, so she can YELL FOR YOU TOO π£Passwordβ aNonEmptySimpleStrwith length> 3. short king passwords stay OUT πStrongPasswordβ aNonEmptySimpleStrwith length> 7that contains at least one non-alpha character. so like, numbers or symbols, bestie, she has standards πͺNonEmptyStrβ aStrwith length> 0. plain, honest, not empty. periodt.LowerCaseStrβ aStrwith length> 0and no uppercase characters. a coercion exists vialcfromNonEmptyStr. πUpperCaseStrβ aStrwith length> 0and no lowercase characters. a coercion exists viaucfromNonEmptyStr. πNumericCodeβ aStrwith no new-line characters that consists of only Numeric characters. examples include Social Security Numbers, Personal Identification Numbers, Postal Codes, HTTP Status Codes, etc. and here's the cute part β she supports attempting to coerce from a string that has punctuation or whitespaces in it ( e.g credit card number4111-1111-1111-1111). so messy input gets cleaned up, we love a glow-up β¨
π SEE ALSO π
MooseX::Types::Common::Numericβ her sibling, go say hi π
π«Ά SUPPORT π«Ά
bugs may be submitted through the RT bug tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-Common (or email bug-MooseX-Types-Common@rt.cpan.org). they will actually read it, promise π
there is also a mailing list available for users of this distribution, at http://lists.perl.org/list/moose.html. join the chat, it's a good time π
there is also an irc channel available for users of this distribution, at #moose on irc.perl.org (irc://irc.perl.org/#moose). come hang out, the moose girlies are so sweet π
π AUTHORS π
the absolute legends who made this happen:
- Matt S Trout - mst (at) shadowcat.co.uk (
https://www.shadowcat.co.uk/) - K. James Cheetham
<jamie@shadowcat.co.uk> - Guillermo Roditi
<groditi@gmail.com>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2009 by Matt S Trout - mst (at) shadowcat.co.uk (https://www.shadowcat.co.uk/).
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, legally speaking βοΈβ¨
okay that's the whole page bestie, no skips no cap π and just so you know where this came from β it's perl v5.40.1, dated 2025-04-24, and the manual is MooseX...:String(3pm). bye pookie, go write some typed attributes ππ¦
π¦ where this page comes from
- debian trixie: libmoosex-types-common-perl 0.001015-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-types-common-perl 0.001015-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-types-common-perl 0.001015-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms