Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

moose::meta::attribute::native::trait::string(3) [osx man page]

Moose::Meta::Attribute::Native::Trait::String(3)	User Contributed Perl Documentation	  Moose::Meta::Attribute::Native::Trait::String(3)

NAME
Moose::Meta::Attribute::Native::Trait::String - Helper trait for Str attributes VERSION
version 2.0604 SYNOPSIS
package MyHomePage; use Moose; has 'text' => ( traits => ['String'], is => 'rw', isa => 'Str', default => q{}, handles => { add_text => 'append', replace_text => 'replace', }, ); my $page = MyHomePage->new(); $page->add_text("foo"); # same as $page->text($page->text . "foo"); DESCRIPTION
This trait provides native delegation methods for strings. DEFAULT TYPE
If you don't provide an "isa" value for your attribute, it will default to "Str". PROVIDED METHODS
o inc Increments the value stored in this slot using the magical string autoincrement operator. Note that Perl doesn't provide analogous behavior in "--", so "dec" is not available. This method returns the new value. This method does not accept any arguments. o append($string) Appends to the string, like ".=", and returns the new value. This method requires a single argument. o prepend($string) Prepends to the string and returns the new value. This method requires a single argument. o replace($pattern, $replacement) Performs a regexp substitution ("s" in perlop). There is no way to provide the "g" flag, but code references will be accepted for the replacement, causing the regex to be modified with a single "e". "/smxi" can be applied using the "qr" operator. This method returns the new value. This method requires two arguments. o match($pattern) Runs the regex against the string and returns the matching value(s). This method requires a single argument. o chop Just like "chop" in perlfunc. This method returns the chopped character. This method does not accept any arguments. o chomp Just like "chomp" in perlfunc. This method returns the number of characters removed. This method does not accept any arguments. o clear Sets the string to the empty string (not the value passed to "default"). This method does not have a defined return value. This method does not accept any arguments. o length Just like "length" in perlfunc, returns the length of the string. o substr This acts just like "substr" in perlfunc. When called as a writer, it returns the substring that was replaced, just like the Perl builtin. This method requires at least one argument, and accepts no more than three. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.16.2 2012-09-19 Moose::Meta::Attribute::Native::Trait::String(3)

Check Out this Related Man Page

Moose::Meta::Attribute::Native::Trait::String(3pm)	User Contributed Perl Documentation	Moose::Meta::Attribute::Native::Trait::String(3pm)

NAME
Moose::Meta::Attribute::Native::Trait::String - Helper trait for Str attributes VERSION
version 2.0603 SYNOPSIS
package MyHomePage; use Moose; has 'text' => ( traits => ['String'], is => 'rw', isa => 'Str', default => q{}, handles => { add_text => 'append', replace_text => 'replace', }, ); my $page = MyHomePage->new(); $page->add_text("foo"); # same as $page->text($page->text . "foo"); DESCRIPTION
This trait provides native delegation methods for strings. DEFAULT TYPE
If you don't provide an "isa" value for your attribute, it will default to "Str". PROVIDED METHODS
o inc Increments the value stored in this slot using the magical string autoincrement operator. Note that Perl doesn't provide analogous behavior in "--", so "dec" is not available. This method returns the new value. This method does not accept any arguments. o append($string) Appends to the string, like ".=", and returns the new value. This method requires a single argument. o prepend($string) Prepends to the string and returns the new value. This method requires a single argument. o replace($pattern, $replacement) Performs a regexp substitution ("s" in perlop). There is no way to provide the "g" flag, but code references will be accepted for the replacement, causing the regex to be modified with a single "e". "/smxi" can be applied using the "qr" operator. This method returns the new value. This method requires two arguments. o match($pattern) Runs the regex against the string and returns the matching value(s). This method requires a single argument. o chop Just like "chop" in perlfunc. This method returns the chopped character. This method does not accept any arguments. o chomp Just like "chomp" in perlfunc. This method returns the number of characters removed. This method does not accept any arguments. o clear Sets the string to the empty string (not the value passed to "default"). This method does not have a defined return value. This method does not accept any arguments. o length Just like "length" in perlfunc, returns the length of the string. o substr This acts just like "substr" in perlfunc. When called as a writer, it returns the substring that was replaced, just like the Perl builtin. This method requires at least one argument, and accepts no more than three. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-28 Moose::Meta::Attribute::Native::Trait::String(3pm)
Man Page