AnyEvent-enabled MozRepl client
use MozRepl::RemoteObject; $ENV{ MOZREPL_CLASS } = 'MozRepl::AnyEvent'; my $bridge = MozRepl::RemoteObject->install_bridge();
This module provides a compatible API to MozRepl solely for what MozRepl::RemoteObject uses. It does not provide plugin support. If you want a fully compatible AnyEvent-enabled MozRepl, please consider porting Net::Telnet to AnyEvent::Handle.
MozRepl::AnyEvent->new( %options )
Creates a new instance.
Options
log - arrayref of log levels to enable
log
Currently only debug is implemented, which will dump some information.
debug
log => [qw[debug],
hdl - a premade AnyEvent::Handle to talk to Firefox (optional)
hdl
prompt - the regex that defines the repl prompt to look for.
prompt
Default is
prompt => qr/^(?:\.+>\s)*(repl\d*)>\s+/m
$repl->log( $level, @info )
Prints the information to STDERR if logging is enabled for the level.
$repl->setup_async( $options, $cb )
my $repl = MozRepl::AnyEvent->setup({ client => { host => 'localhost', port => 4242, }, log => ['debug'], });
Sets up the repl connection. See MozRepl::setup for detailed documentation.
Returns a CV to wait on that signals when setup is done.
$repl->setup(...)
Synchronous version of ->setup_async, provided for API compatibility. This one will do a ->recv call inside.
->setup_async
->recv
$repl->repl
Returns the name of the repl in Firefox.
$repl->hdl
Returns the socket handle of the repl.
$repl->execute_async( $command, $cb )
my $cv = $repl->execute_async( '1+1' ); # do stuff my $two = $cv->recv; print "1+1 is $two\n";
Sends a command to Firefox for execution. Returns the condvar to wait for the response.
$repl->execute( ... )
Synchronous version of ->execute_async. Internally calls ->recv. Provided for API compatibility.
->execute_async
MozRepl for the module defining the API
AnyEvent for AnyEvent
The public repository of this module is http://github.com/Corion/mozrepl-remoteobject.
Max Maischein corion@cpan.org
corion@cpan.org
Copyright 2009-2011 by Max Maischein corion@cpan.org.
This module is released under the same terms as Perl itself.
To install MozRepl::RemoteObject, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MozRepl::RemoteObject
CPAN shell
perl -MCPAN -e shell install MozRepl::RemoteObject
For more information on module installation, please visit the detailed CPAN module installation guide.