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,
21 and you'll get the adequate filter.
22
23 Constructor calling convention
24 The constructor is called with a single code reference. The code
25 reference must conform to the standard "filter()" signature for header
26 filters:
27
28 sub filter { my ( $self, $headers, $message) = @_; ... }
29
30 This code reference is used for the "filter()" method.
31
33 This filter "factory" defines the standard HTTP::Proxy::HeaderFilter
34 methods, but those are only, erm, "proxies" to the actual CODE
35 references passed to the constructor. These "proxy" methods are:
36
37 filter()
38 begin()
39 end()
40
41 Two other methods are actually HTTP::Proxy::HeaderFilter::simple
42 methods, and are called automatically:
43
44 init()
45 Initalise the filter instance with the code references passed to
46 the constructor.
47
48 can()
49 Return the actual code reference that will be run, and not the
50 "proxy" methods. If called with any other name than "begin" and
51 "filter", it calls "UNIVERSAL::can()" instead.
52
54 HTTP::Proxy, HTTP::Proxy::HeaderFilter.
55
57 Philippe "BooK" Bruhat, <book@cpan.org>.
58
60 Copyright 2003-2015, Philippe Bruhat.
61
63 This module is free software; you can redistribute it or modify it
64 under the same terms as Perl itself.
65
66
67
68perl v5.28.0 2015-06-1H6TTP::Proxy::HeaderFilter::simple(3)