MozRepl::AnyEvent - 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.
Instead of using the process environment, you can also pass the backend class using the repl_class parameter in the constructor:
repl_class
use MozRepl::RemoteObject; my $bridge = MozRepl::RemoteObject->install_bridge( repl_class => 'MozRepl::AnyEvent', );
The module in repl_class will be loaded through require. If the module does not load, the fatal error will propagate. No fallbacks are tried.
require
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 )
my $repl = MozRepl::AnyEvent->setup({ client => { host => 'localhost', port => 4242, }, log => ['debug'], cv => $cv, });
Sets up the repl connection. See MozRepl::setup for detailed documentation.
The optional CV will get the repl through ->send().
->send()
Returns the 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.