in reply to LWP handlers examples?
use strict; use warnings; use LWP::UserAgent qw( ); my $ua = LWP::UserAgent->new(); my $url = 'http://www.google.com/'; print("Added:\n"); $ua->add_handler(response_header => sub { print "HANDLER\n"; }); print($ua->get($url)->status_line(), "\n"); print("Removed:\n"); $ua->remove_handler('response_header'); print($ua->get($url)->status_line(), "\n");
Added: HANDLER HANDLER 200 OK Removed: 200 OK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: LWP handlers examples?
by vitoco (Hermit) on Aug 12, 2009 at 19:42 UTC | |
by almut (Canon) on Aug 12, 2009 at 21:51 UTC | |
by vitoco (Hermit) on Aug 13, 2009 at 18:37 UTC | |
by ikegami (Patriarch) on Aug 12, 2009 at 20:06 UTC | |
by vitoco (Hermit) on Aug 12, 2009 at 20:59 UTC |