++ed by:
1 non-PAUSE user
Author image Max Maischein


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:

  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.


MozRepl::AnyEvent->new( %options )

Creates a new instance.


  • log - arrayref of log levels to enable

    Currently only debug is implemented, which will dump some information.

      log => [qw[debug],
  • hdl - a premade AnyEvent::Handle to talk to Firefox (optional)

  • prompt - the regex that defines the repl prompt to look for.

    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().

Returns the CV to wait on that signals when setup is done.


Synchronous version of ->setup_async, provided for API compatibility. This one will do a ->recv call inside.


Returns the name of the repl in Firefox.


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.


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


Copyright 2009-2012 by Max Maischein corion@cpan.org.


This module is released under the same terms as Perl itself.