X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FAttributeHelpers%2FMethodProvider%2FString.pm;h=21748a713d76b1bf9b4b4489c0206d6015f6485f;hb=f94676b6e7d8cee4cce2832fdcf0ee3901a48387;hp=3be3f054b01541d9c5432507c6816e7e4572f85b;hpb=8f614ba830656fc114d366ce86219db200dbc32f;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/lib/MooseX/AttributeHelpers/MethodProvider/String.pm b/lib/MooseX/AttributeHelpers/MethodProvider/String.pm index 3be3f05..21748a7 100644 --- a/lib/MooseX/AttributeHelpers/MethodProvider/String.pm +++ b/lib/MooseX/AttributeHelpers/MethodProvider/String.pm @@ -2,11 +2,11 @@ package MooseX::AttributeHelpers::MethodProvider::String; use Moose::Role; -our $VERSION = '0.14'; +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. @@ -154,7 +164,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2007-2008 by Infinity Interactive, Inc. +Copyright 2007-2009 by Infinity Interactive, Inc. L