1 package MooseX::AttributeHelpers::String;
3 use MooseX::AttributeHelpers::MethodProvider::String;
5 extends 'MooseX::AttributeHelpers::Base';
8 our $AUTHORITY = 'cpan:STEVAN';
17 method_provider => 'String',
31 MooseX::AttributeHelpers::String
37 use MooseX::AttributeHelpers;
40 metaclass => 'String',
43 default => sub { '' },
46 replace => "replace_text",
50 my $page = MyHomePage->new();
51 $page->add_text("foo"); # same as $page->text($page->text . "foo");
55 This module provides a simple string attribute, to which mutating string
56 operations can be applied more easily (no need to make an lvalue attribute
57 metaclass or use temporary variables). Additional methods are provided for
60 If your attribute definition does not include any of I<is>, I<isa>,
61 I<default> or I<provides> but does use the C<String> metaclass,
62 then this module applies defaults as in the L</SYNOPSIS>
63 above. This allows for a very basic attribute definition:
65 has 'foo' => (metaclass => 'String');
68 =head1 PROVIDED METHODS
70 The methods for this metaclass are provided by
71 L<MooseX::AttributeHelpers::MethodProvider::String>.
75 All complex software has bugs lurking in it, and this module is no
76 exception. If you find a bug please either email me, or add the bug
81 Stevan Little E<lt>stevan@iinteractive.comE<gt>
83 =head1 COPYRIGHT AND LICENSE
85 Copyright 2007-2008 by Infinity Interactive, Inc.
87 L<http://www.iinteractive.com>
89 This library is free software; you can redistribute it and/or modify
90 it under the same terms as Perl itself.