Subject: | Support chained calls to ->apply_tagged |
Would it be possible to return $self from ->apply_tagged, and maybe other methods as well?
Instead of this:
my $v = String::Tagged->new(strftime '%Y-%m-%d %H:%M:%S', localtime $item);
$v->apply_tag( 0, 4, b => 1);
$v->apply_tag( 6, 2, b => 1);
$v->apply_tag( 8, 2, b => 1);
$v->apply_tag(12, 2, fg => 2);
$v->apply_tag(14, 2, fg => 4);
$v->apply_tag(16, 2, fg => 1);
Future->wrap(
$v
)
it'd be nice to have the ability to write as a single expression:
Future->wrap(
String::Tagged->new(strftime '%Y-%m-%d %H:%M:%S', localtime $item)
->apply_tag( 0, 4, b => 1)
->apply_tag( 6, 2, b => 1)
->apply_tag( 8, 2, b => 1)
->apply_tag(12, 2, fg => 2)
->apply_tag(14, 2, fg => 4)
->apply_tag(16, 2, fg => 1)
)
cheers,
Tom