NAME

WWW::Crawl4AI::Attempt - one strategy attempt in a WWW::Crawl4AI fallback chain

VERSION

version 0.001

SYNOPSIS

my $attempt = WWW::Crawl4AI::Attempt->new(
  backend    => 'crawl4ai_plain',
  cost_class => 'cheap',
  ok         => 0,
  page       => $normalized_page,
  signals    => { blocked => 1 },
  why_failed => 'bot_wall_detected',
  elapsed    => 1.42,
);

DESCRIPTION

Records a single run of one WWW::Crawl4AI::Strategy against a URL: which backend, whether it produced a good page, the classification signals, and why it failed if it did. The chain keeps every attempt so the final WWW::Crawl4AI::Result can explain itself to an agent.

backend

Strategy backend name, e.g. crawl4ai_plain, crawl4ai_cloakbrowser.

cost_class

One of cheap, browser, stealth, paid.

ok

True if this attempt's page passed classification.

page

The normalized page hashref from WWW::Crawl4AI::Client, if the call returned one.

signals

The "signals" in WWW::Crawl4AI::Detect hashref for the page.

why_failed

Short failure token when ok is false (see "why_failed" in WWW::Crawl4AI::Detect).

error

A WWW::Crawl4AI::Error or string, when the attempt threw rather than returning a poor page.

elapsed

Wall-clock seconds the attempt took.

to_hash

A JSON-safe plain-hash view of the attempt (booleans as \1/\0, error stringified). Markdown is reduced to markdown_len so attempt history stays compact.

TO_JSON

Alias for "to_hash", for JSON::MaybeXS->new(convert_blessed => 1).

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-crawl4ai/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.