curry(3)
okay so bestie, this is curry(3) from the User Contributed Perl Documentation, and it's literally the manual page for curry β the module that creates automatic curried method call closures for any class or object. no cap, it's giving tiny-but-mighty icon behavior π
β¨ NAME β¨
curry β create automatic curried method call closures for any class or object π
πΈ SYNOPSIS πΈ
okay so here's the vibe:
use curry;
my $code = $obj->curry::frobnicate('foo');
is equivalent to:
my $code = sub { $obj->frobnicate(foo => @_) };
If you have a method name (or a coderef), you can call (as of version 2):
my $code = $obj->curry::_($method => 'foo');
Additionally,
use curry::weak;
my $code = $obj->curry::weak::frobnicate('foo');
is equivalent to:
my $code = do {
Scalar::Util::weaken(my $weak_obj = $obj);
sub {
return unless $weak_obj; # in case it already went away
$weak_obj->frobnicate(foo => @_)
};
};
Similarly, given a method name or coderef (as of version 2):
my $code = $obj->curry::weak::_($method => 'foo');
There are also $curry::curry and $curry::weak globals that work equivalently to curry::_ and curry::weak::_ respectively β you'll quite possibly see them in existing code because they were provided in pre-2.0 versions, but they're unlikely to be the best option for new code. iykyk π
π₯ RATIONALE π₯
How many times have you written
sub { $obj->something($some, $args, @_) }
or worse still needed to weaken it and had to check and re-check your code to be sure you weren't closing over things the wrong way? π
Right. That's why I wrote this. periodt. π
π AUTHOR π
mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk> π«Ά
π CONTRIBUTORS π
None yet - maybe this software is perfect! (ahahahahahahahahaha) π
π COPYRIGHT π
Copyright (c) 2012 the curry "AUTHOR" and "CONTRIBUTORS" as listed above. πΈ
π LICENSE π
This library is free software and may be distributed under the same terms as perl itself. slay β¨
okay bye bestie β this lil page is from perl v5.42.0, dated 2021-12-31, and it's the curry(3) manpage. mwah π
π¦ where this page comes from
- opensuse-leap 16.0: perl-curry 2.000001-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms