Browsermob::Server - Perl client to control the Browsermob Proxy server
version 0.04
my $server = Browsermob::Server->new( path => '/path/to/browsermob-proxy' ); $server->start; my $proxy = $server->create_proxy; print $proxy->port; $proxy->create_har('Test'); # generate traffic across your port $proxy->har; # returns a HAR
Alternatively, assuming there's a BMP server on 63636 for example,
my $server = Browsermob::Server->new( port => 63636 ); my $proxy = $server->create_proxy;
This class provides a way to control the Browsermob Proxy server within Perl. There are only a few public methods for starting and stopping the server. You also have the option of instantiating a server object and pointing it towards an existing BMP server on localhost, and just using it to avoid having to pass the server_port arg when instantiating new proxies.
The path to the browsermob_proxy binary. If you aren't planning to call start, this is optional.
start
The port on which the proxy server should run. This is not the port that you should have other clients connect.
Start a browsermob proxy on port. Starting the server does not create any proxies.
port
Stop the forked browsermob-proxy server. This does not work all the time, although the server seems to get GC'd all on its own, even after ignoring a SIGTERM.
SIGTERM
After starting the server, or connecting to an existing one, use create_proxy to get a proxy that you can use with your tests. No proxies actually exist until you call create_proxy; starting the server does not create a proxy.
create_proxy
my $proxy = $bmp->create_proxy; # returns a Browsermob::Proxy object my $proxy = $bmp->create_proxy(port => 1337);
Get a list of currently registered proxies.
my $proxy_aref = $bmp->get_proxies->{proxyList}; print scalar @$proxy_aref;
Please see those modules/websites for more information related to this module.
Browsermob::Proxy
Please report any bugs or feature requests on the bugtracker website https://github.com/gempesaw/Browsermob-Proxy/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Daniel Gempesaw <gempesaw@gmail.com>
To install Browsermob::Proxy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Browsermob::Proxy
CPAN shell
perl -MCPAN -e shell install Browsermob::Proxy
For more information on module installation, please visit the detailed CPAN module installation guide.