NAME
Data::Focus::Lens::Composite - a lens composed of multiple lenses
SYNOPSIS
my
$composite1
= Data::Focus::Lens::Composite->new(
$lens1
,
$lens2
,
$lens3
);
## or
my
$composite2
=
$lens1
.
$lens2
.
$lens3
;
## Then, you can write
my
$value1
= focus(
$target
)->get(
$composite1
);
my
$value2
= focus(
$target
)->get(
$composite2
);
## instead of
my
$value3
= focus(
$target
)->get(
$lens1
,
$lens2
,
$lens3
);
## $value1 == $value2 == $value3
DESCRIPTION
Data::Focus::Lens::Composite is a Data::Focus::Lens class that is composed of multiple lenses.
CLASS METHODS
$composite = Data::Focus::Lens::Composite->new(@lenses)
Compose @lenses
to create a $composite
lens.
@lenses
are composed in the same order as you pass them to into()
, get()
etc methods of Data::Focus.
If some of the @lenses
are not Data::Focus::Lens objects, they are coerced to lenses. See "Lens Coercion" in Data::Focus for detail.
If @lenses
is empty, it returns a no-op lens.
OBJECT METHODS
apply_lens
See Data::Focus::Lens.
AUTHOR
Toshio Ito, <toshioito at cpan.org>