Data::Perl::String - Wrapping class for Perl scalar strings.
version 0.001003
use Data::Perl qw/string/; my $string = string("foo\n"); $string->chomp; # returns 1, $string == "foo"
This class provides a wrapper and methods for interacting with scalar strings.
Constructs a new Data::Perl::String object, optionally initialized to $value if passed in, and returns it.
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.
--
dec
This method does not accept any arguments.
Appends to the string, like .=, and returns the new value.
.=
This method requires a single argument.
Prepends to the string and returns the new value.
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.
g
e
/smxi
qr
This method requires two arguments.
Runs the regex against the string and returns the matching value(s).
Just like "chop" in perlfunc. This method returns the chopped character.
Just like "chomp" in perlfunc. This method returns the number of characters removed.
Sets the string to the empty string (not the value passed to default).
default
This method does not have a defined return value.
Just like "length" in perlfunc, returns the length of the string.
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.
Data::Perl
MooX::HandlesVia
Matthew Phillips <mattp@cpan.org>
This software is copyright (c) 2013 by Matthew Phillips <mattp@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
10 POD Errors
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install Data::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Perl
CPAN shell
perl -MCPAN -e shell install Data::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.