<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use strict;
use warnings;
use feature qw( say );

use LWP::UserAgent;
my $ua = LWP::UserAgent-&gt;new;

my @phases = (
    'request_preprepare', 'request_prepare',
    'request_send',       'response_header',
    'response_data',      'response_done',
    'response_redirect',
);

for my $phase (@phases) {
    $ua-&gt;add_handler($phase =&gt; sub { say "$phase"; return undef; });
}

$ua-&gt;get('http://example.com');
</pre></body></html>