GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DATA::PERL::ROLE::STRING (3)

.ds Aq ’

NAME

Data::Perl::Role::String - Wrapping class for Perl scalar strings.

CONTENTS

VERSION

version 0.002009

SYNOPSIS



  use Data::Perl qw/string/;

  my $string = string("foo\n");

  $string->chomp; # returns 1, $string == "foo"



DESCRIPTION

This class provides a wrapper and methods for interacting with scalar strings.

PROVIDED METHODS

o <B>new($value)B>

Constructs a new Data::Perl::String object, optionally initialized to $value if passed in, and returns it.

o <B>incB>

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 <B>append($string)B>

Appends to the string, like .=, and returns the new value.

This method requires a single argument.

o <B>prepend($string)B>

Prepends to the string and returns the new value.

This method requires a single argument.

o <B>replace($pattern, B>$replacement<B>)B>

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 <B>match($pattern)B>

Runs the regex against the string and returns the matching value(s).

This method requires a single argument.

o <B>chopB>

Just like chop in perlfunc. This method returns the chopped character.

This method does not accept any arguments.

o <B>chompB>

Just like chomp in perlfunc. This method returns the number of characters removed.

This method does not accept any arguments.

o <B>clearB>

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 <B>lengthB>

Just like length in perlfunc, returns the length of the string.

o <B>substrB>

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.

SEE ALSO

o Data::Perl
o MooX::HandlesVia

AUTHOR

Matthew Phillips <mattp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DATA::PERL::ROLE::STRING (3) 2014-06-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.