Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (27 sloc) 1.06 KB
=begin pod
=TITLE class Capture
class Capture does Positonal does Associative { }
A Capture is a an argument list for passing it to a code object.
It contains a list-like part for positional arguments and a hash-like part
for named arguments.
Captures can be created by prefixing a term with a backslash C<\>.
my $c = \42; # Capture with one positional parts
$c = \(1, 2, a => 'b'); # Capture wit two positional and one named part
Another common way to create a Capture is to prefix a sigilless parameter
with a vertical bar C<|>, which packs the remainder of the argument list
into that parameter.
f(1, 2, 3, a => 4, b => 5;
sub f($a, |c) {
# c is \(2, 3, a => 4, b => 5)
=head1 Methods
=head2 list
method list(Capture:D:) returns Positional
Returns the positional part of the Capture.
=head2 hash
method hash(Capture:D:) returns Associative
Returns the named/hash part of the Capture.
=head2 elems
method elems(Capture:D:) returns Int:D
Returns the number of positional elements in the Capture.
=end pod
Jump to Line
Something went wrong with that request. Please try again.