1Moose::Meta::Attribute:U:sNeartiCvoen:tM:roTiorbsaueit:te::dM:eSPttearr:il:nAgDt(ot3cr)uimbeunttea:t:iNoantive::Trait::String(3)
2
3
4

NAME

6       Moose::Meta::Attribute::Native::Trait::String - Helper trait for Str
7       attributes
8

VERSION

10       version 2.2206
11

SYNOPSIS

13         package MyHomePage;
14         use Moose;
15
16         has 'text' => (
17             traits  => ['String'],
18             is      => 'rw',
19             isa     => 'Str',
20             default => q{},
21             handles => {
22                 add_text     => 'append',
23                 replace_text => 'replace',
24             },
25         );
26
27         my $page = MyHomePage->new();
28         $page->add_text("foo");    # same as $page->text($page->text . "foo");
29

DESCRIPTION

31       This trait provides native delegation methods for strings.
32

DEFAULT TYPE

34       If you don't provide an "isa" value for your attribute, it will default
35       to "Str".
36

PROVIDED METHODS

38inc
39
40           Increments the value stored in this slot using the magical string
41           autoincrement operator. Note that Perl doesn't provide analogous
42           behavior in "--", so "dec" is not available. This method returns
43           the new value.
44
45           This method does not accept any arguments.
46
47append($string)
48
49           Appends to the string, like ".=", and returns the new value.
50
51           This method requires a single argument.
52
53prepend($string)
54
55           Prepends to the string and returns the new value.
56
57           This method requires a single argument.
58
59replace($pattern, $replacement)
60
61           Performs a regexp substitution ("s" in perlop). There is no way to
62           provide the "g" flag, but code references will be accepted for the
63           replacement, causing the regex to be modified with a single "e".
64           "/smxi" can be applied using the "qr" operator. This method returns
65           the new value.
66
67           This method requires two arguments.
68
69match($pattern)
70
71           Runs the regex against the string and returns the matching
72           value(s).
73
74           This method requires a single argument.
75
76chop
77
78           Just like "chop" in perlfunc. This method returns the chopped
79           character.
80
81           This method does not accept any arguments.
82
83chomp
84
85           Just like "chomp" in perlfunc. This method returns the number of
86           characters removed.
87
88           This method does not accept any arguments.
89
90clear
91
92           Sets the string to the empty string (not the value passed to
93           "default").
94
95           This method does not have a defined return value.
96
97           This method does not accept any arguments.
98
99length
100
101           Just like "length" in perlfunc, returns the length of the string.
102
103substr
104
105           This acts just like "substr" in perlfunc. When called as a writer,
106           it returns the substring that was replaced, just like the Perl
107           builtin.
108
109           This method requires at least one argument, and accepts no more
110           than three.
111

BUGS

113       See "BUGS" in Moose for details on reporting bugs.
114

AUTHORS

116       •   Stevan Little <stevan@cpan.org>
117
118       •   Dave Rolsky <autarch@urth.org>
119
120       •   Jesse Luehrs <doy@cpan.org>
121
122       •   Shawn M Moore <sartak@cpan.org>
123
124       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
125
126       •   Karen Etheridge <ether@cpan.org>
127
128       •   Florian Ragwitz <rafl@debian.org>
129
130       •   Hans Dieter Pearcey <hdp@cpan.org>
131
132       •   Chris Prather <chris@prather.org>
133
134       •   Matt S Trout <mstrout@cpan.org>
135
137       This software is copyright (c) 2006 by Infinity Interactive, Inc.
138
139       This is free software; you can redistribute it and/or modify it under
140       the same terms as the Perl 5 programming language system itself.
141
142
143
144perl v5.38.0                  Moos2e0:2:3M-e0t7a-:2:3Attribute::Native::Trait::String(3)
Impressum