App-Raider
view release on metacpan or search on metacpan
.claude/skills/perl-io-async-future/SKILL.md view on Meta::CPAN
->on_fail(sub {
my $self = $weak or return;
delete $self->{_reconnect_future};
$self->_reconnect_attempt; # try again
});
}
```
**Rules:**
- Store the *whole chain* on the object (`$self->{_reconnect_future}`), not just the leaf.
- `weaken` `$self` inside callbacks â otherwise the chain holds the object alive forever.
- Always `delete $self->{_reconnect_future}` in both `on_done` and `on_fail`, or you'll guard out future reconnects with `return if $self->{_reconnect_future}`.
- On disconnect, **cancel the old `_connect_future`** so its async sub unwinds:
```perl
if (my $f = delete $self->{_connect_future}) {
$f->fail("disconnected: $reason") unless $f->is_ready;
}
```
---
.claude/skills/perl-io-async-future/SKILL.md view on Meta::CPAN
# Observe without composing (does NOT chain â return value ignored)
$f->on_done(sub { warn "done: @_" });
$f->on_fail(sub { warn "failed: $_[0]" });
```
**`then` vs `on_done`:**
- `then` returns a *new* Future; the callback returns a Future to chain. Use for control flow.
- `on_done` returns the *same* Future; callback return value is discarded. Use for side-effects/observation.
**Protective composition** (Future ⥠0.51): pass extra siblings via `also =>` to keep them alive without making cancellation propagate:
```perl
Future->needs_all($f1, also => $f2, $f3);
```
---
## Pattern 5 â `->retain` for Fire-and-Forget
When you legitimately want to start an op and not wait, but still need it to *finish*:
( run in 0.551 second using v1.01-cache-2.11-cpan-df04353d9ac )