NAME
Text::Label::Prepender - dynamically prepend label to input strings
SYNOPSIS
use Text::Label::Prepender;
my $prepender = Text::Label::Prepender->new (
initial_label => '.', # initial label
separator => '/', # output between label and data line
label_char => ':', # the character signifying a line is a label
) ;
my @input = qw(aaa bbb ccc one one/hump: ddd eee fff two/hump: ggg hhh iii);
for (@input) {
if (my $processed = $prepender->process($_)) {
print $processed, "\n";
}
}
OUTPUT:
./aaa
./bbb
./ccc
one/hump/ddd
one/hump/eee
one/hump/fff
two/hump/ggg
two/hump/hhh
two/hump/iii
DESCRIPTION
This object-oriented package processes input lines, taking a _label_ like:
food/bar:
and prepends the contents of the label line (sans delimiter) to all successive lines, until the next label line comes along. This is the sort of listing that ls -lR would produce.
EXPORT
None by default.
AUTHOR
T. M. Brannon, <tbone@cpan.org>
This program is nothing but an OOP-ization of p.224 of "Programming Perl", the edition for Perl 4, which I guess means that Randal Schwartz originally wrote this program.
I thought it would be a nice tool for someone someday and it has been awhile since I wrote anything object-oriented, so what the hay?!
SEE ALSO
perl.