1HTTP::Proxy::HeaderFiltUesre:r:sCiomnptlrei(b3u)ted PerlHTDToPc:u:mPernotxayt:i:oHneaderFilter::simple(3)
2
3
4
6 HTTP::Proxy::HeaderFilter::simple - A class for creating simple filters
7
9 use HTTP::Proxy::HeaderFilter::simple;
10
11 # a simple User-Agent filter
12 my $filter = HTTP::Proxy::HeaderFilter::simple->new(
13 sub { $_[1]->header( User_Agent => 'foobar/1.0' ); }
14 );
15 $proxy->push_filter( request => $filter );
16
18 HTTP::Proxy::HeaderFilter::simple can create BodyFilter without going
19 through the hassle of creating a full-fledged class. Simply pass a code
20 reference to the filter() method of your filter to the constructor, and
21 you'll get the adequate filter.
22
23 Constructor calling convention
24
25 The constructor is called with a single code reference. The code ref‐
26 erence must conform to the standard filter() signature for header fil‐
27 ters:
28
29 sub filter { my ( $self, $headers, $message) = @_; ... }
30
31 This code reference is used for the filter() method.
32
34 This filter "factory" defines the standard HTTP::Proxy::HeaderFilter
35 methods, but those are only, erm, "proxies" to the actual CODE refer‐
36 ences passed to the constructor. These "proxy" methods are:
37
38 filter()
39 begin()
40 end()
41
42 Two other methods are actually HTTP::Proxy::HeaderFilter::simple meth‐
43 ods, and are called automatically:
44
45 init()
46 Initalise the filter instance with the code references passed to
47 the constructor.
48
49 can()
50 Return the actual code reference that will be run, and not the
51 "proxy" methods. If called with any other name than "begin" and
52 "filter", it calls UNIVERSAL::can() instead.
53
55 HTTP::Proxy, HTTP::Proxy::HeaderFilter.
56
58 Philippe "BooK" Bruhat, <book@cpan.org>.
59
61 Copyright 2003-2005, Philippe Bruhat.
62
64 This module is free software; you can redistribute it or modify it
65 under the same terms as Perl itself.
66
67
68
69perl v5.8.8 2006-09-0H4TTP::Proxy::HeaderFilter::simple(3)