X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FAttributeHelpers%2FMethodProvider%2FString.pm;h=3581d537a20063c86cdf67e5c846ab11d7b4fe3f;hb=2e74144c8801485e5c33fdcdcbee9f7d882c1a3a;hp=b6e003905f93ceaf81f74cc401910474edbdbce6;hpb=9c5d164e4f0f366d543d262d60c774814ecea197;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/lib/MooseX/AttributeHelpers/MethodProvider/String.pm b/lib/MooseX/AttributeHelpers/MethodProvider/String.pm index b6e0039..3581d53 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.17'; +our $VERSION = '0.23'; $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.