X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FAttributeHelpers%2FMethodProvider%2FString.pm;h=21748a713d76b1bf9b4b4489c0206d6015f6485f;hb=6c321470afd71bf53767618279e3b7bd7dd8cb10;hp=716e9d4a26dd8b8110be073bb9bc6d7e51829422;hpb=8718af0739ba26a53195fa4396a9af99c8df9eea;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/lib/MooseX/AttributeHelpers/MethodProvider/String.pm b/lib/MooseX/AttributeHelpers/MethodProvider/String.pm index 716e9d4..21748a7 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/String.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/String.pm @@ -6,7 +6,7 @@ our $VERSION = '0.21'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -sub append : method { +sub append : method { my ($attr, $reader, $writer) = @_; return sub { $writer->( $_[0], $reader->($_[0]) . $_[1] ) }; @@ -72,6 +72,14 @@ sub clear : method { return sub { $writer->( $_[0], '' ) } } +sub length : method { + my ($attr, $reader, $writer) = @_; + return sub { + my $v = $reader->($_[0]); + return CORE::length($v); + }; +} + sub substr : method { my ($attr, $reader, $writer) = @_; return sub { @@ -104,10 +112,10 @@ __END__ =head1 NAME MooseX::AttributeHelpers::MethodProvider::String - + =head1 DESCRIPTION -This is a role which provides the method generators for +This is a role which provides the method generators for L. =head1 METHODS @@ -138,13 +146,15 @@ L. =item B +=item B + =item B =back =head1 BUGS -All complex software has bugs lurking in it, and this module is no +All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.