Launcher::Cascade::ListOfStrings - a wrapper around an array to make it inherit from Launcher::Cascade::Printable
use Launcher::Cascade::ListOfStrings; my $l = new Launcher::Cascade::ListOfStrings -list => [ 'some', 'strings', 'to', 'start', 'with' ], ; push @$l, 'and', 'then', 'some'; print $l->as_string; print "$l"; # same as above # alter the formatting $l->separator(q{, }); $l->preparator(sub { qq{"$_"} }); print "$l\n"; # prints quoted strings separated by comas
A coderef used to prepare each element in list() before including it the generated string. The coderef will be invoked with $_ locally aliased to the current element. By default, preparator() is the identity function (i.e., it returns $_ untouched).
$_
The string to insert between each element in list() when generating a string (sort of like Perl's $" built-in variable. See perlvar). Defaults to the empty string.
$"
Strings to prepend and, respectively, append, to the string representation of the list(). Both default to the empty string.
The reference to the array containing the elements. This can also be accessed by dereferencing the object as if it were an array reference (see SYNOPSIS).
Returns a string representation of the object. Each element in list() is first passed on to the coderef in preparator(), and the list of results from preparator() is concatenated with the value of separator().
This method is called when the object is "stringified", i.e., when it is interpolated in a double-quoted string.
my $l = new Launcher::Cascade::ListOfStrings -list => [ qw( frodo pippin merry sam ) ]; $l->separator(q{, }); $l->preparator(sub { ucfirst }); print "$l\n"; # "Frodo, Pippin, Merry, Sam" and a newline
Launcher::Cascade::Printable
Cédric Bouvier <cbouvi@cpan.org>
<cbouvi@cpan.org>
Copyright (C) 2006 Cédric Bouvier, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Cédric'. Assuming CP1252
To install Launcher::Cascade, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Launcher::Cascade
CPAN shell
perl -MCPAN -e shell install Launcher::Cascade
For more information on module installation, please visit the detailed CPAN module installation guide.