NAME

HTTP::Proxy::GreaseMonkey - Run GreaseMonkey scripts in any browser

VERSION

This document describes HTTP::Proxy::GreaseMonkey version 0.02

SYNOPSIS

  use HTTP::Proxy;
  use HTTP::Proxy::GreaseMonkey;

  my $proxy = HTTP::Proxy->new( port => 8030 );
  my $gm = HTTP::Proxy::GreaseMonkey->new;
  $gm->add_script( 'gm/myscript.js' );
  $proxy->push_filter(
      mime     => 'text/html',
      response => $gm
  );
  $proxy->start;

DESCRIPTION

GreaseMonkey allows arbitrary user defined Javascript to be run against specific pages. Unfortunately GreaseMonkey only works with FireFox.

HTTP::Proxy::GreaseMonkey creates a local HTTP proxy that allows GreaseMonkey user scripts to be used with any browser.

When you install HTTP::Proxy::GreaseMonkey a program called gmproxy is installed in your default bin directory. To launch the GreaseMonkey proxy issue a command something like this:

$ gmproxy ~/.userscripts

By default the proxy will listen on port 8030. The supplied directory is scanned before each request; any scripts that have been updated or added will be reloaded and any that have been deleted will be discarded.

On MacOS net.hexten.gmproxy.plist is created in the project home directory. To add gmproxy as a launch item do

$ cp net.hexten.gmproxy.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/net.hexten.gmproxy.plist
$ launchctl start net.hexten.gmproxy

Patches welcome from anyone who has equivalent instructions for other platforms.

Limitations

Currently none of the GM_* functions are supported. If anyone has a good idea about how to support them please drop me a line.

INTERFACE

add_script( $script )

Add a GM script to the proxy. The argument may be the filename of a script or an existing HTTP::Proxy::GreaseMonkey::Script.

verbose

Set / get verbosity.

will_modify

Will this filter modify content? Called by HTTP::Proxy.

begin

Called at the start of processing.

filter

The filter entry point. Called for each chunk of input.

end

Finished processing.

CONFIGURATION AND ENVIRONMENT

HTTP::Proxy::GreaseMonkey requires no configuration files or environment variables.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-http-proxy-greasemonkey@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Andy Armstrong <andy@hexten.net>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Andy Armstrong <andy@hexten.net>.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.