Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Data::Perl::Role::StriUser)Contributed Perl DocumenData::Perl::Role::String(3)

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

VERSION
       version 0.002011

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   new($value)

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

       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.

SEE ALSO
       o   Data::Perl

       o   MooX::HandlesVia

AUTHOR
       Matthew Phillips	<mattp@cpan.org>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2020 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.

perl v5.32.1			  2020-01-22	   Data::Perl::Role::String(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | PROVIDED METHODS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Data::Perl::Role::String&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help