MozRepl - Perl interface of MozRepl


MozRepl documentation  | view source Contained in the MozRepl distribution.

Index


NAME

Top

MozRepl - Perl interface of MozRepl

VERSION

Top

version 0.06

SYNOPSIS

Top

    use strict;
    use warnings;

    use MozRepl;

    my $repl = MozRepl->new;
    $repl->setup; ### You must write it.

    $repl->execute(q|window.alert("Internet Explorer:<")|);

    print $repl->repl_inspect({ source => "window" });
    print $repl->repl_search({ pattern => "^getElement", source => "document"});

DESCRIPTION

Top

MozRepl is accessing and control firefox using telnet, provided MozLab extension. This module is perl interface of MozRepl.

Additionaly this is enable to extend by writing plugin module. You want to write plugin, see MozRepl::Plugin::Base or other plugins.

For cygwin users

In cygwin, please add binmode param as 1 in client args.

    $repl->setup({
        client => {
            extra_client_args => {
                binmode => 1
            }
        }
    });

METHODS

Top

new($args)

Create MozRepl instance. One argument, and it must be hash reference.

Module::Pluggable::Fast's arguments. If you want to search modules has not prefix like 'MozRepl::Plugin', then you are set this value like below.

  my $repl = MozRepl->new({ search => [qw/MyRepl::Plugin OtherRepl::Plugin/] });

setup($args)

Setup logging, client, plugins. One argument, must be hash reference.

log

Hash reference or undef. See setup_log($args) in MozRepl, new($args) in MozRepl::Log.

client

Hash reference or undef. See setup_client($args) in MozRepl, new($ctx, $args) in MozRepl::Client.

plugins

Hash reference or undef See setup_plugins($args) in MozRepl.

setup_log($args)

Create logging instance. default class is MozRepl::Log. If you want to change log class, then set class name using log_class($class) in MozRepl.

This method is only called in setup($args) in MozRepl.

One arguments, array reference. If you want to limit log levels, specify levels like below.

    $repl->setup_log([qw/info warn error fatal/]);

See new($args) in MozRepl::Log.

If you want to use another log class, and already instanciate it, then you should call and set the instance before setup() method process.

Example,

    my $repl = MozRepl->new;
    $repl->log($another_log_instance);
    $repl->setup($config);

setup_client($args)

Create (telnet) client instance. default class is MozRepl::Client. If you want to change client class, then set class name using client_class($class) in MozRepl.

This method is only called in setup($args) in MozRepl.

One arguments, hash reference. See new($ctx, $args) in MozRepl::Client.

setup_plugins($args)

Setup plugins. One argument, must be hash reference, it will be passed each plugin's as new method arguments. And load_plugins($args) in MozRepl too.

This method is only called in setup($args) in MozRepl.

setup_plugin($plugin, $args)

Create plugin instance, and mixin method to self. Method name is detect by plugin's package, see plugin_to_method($plugin, $search) in MozRepl::Util.

load_plugins

Load available plugins. One argument, must be hash reference or undef.

plugins

Array reference. Specify only plugins you want to use.

    $repl->load_plugins({ plugins => [qw/Repl::Print Repl::Inspect/] });

except_plugins

Array reference. Specify except plugins you want to use.

    $repl->load_plugins({ except_plugins => [qw/JSON/] });

enable_plugin($plugin)

Return whether the specified plugin is enabled or not.

execute($command)

Execute command and return result string. See execute($command) in MozRepl::Client.

finalize()

Finalize connection.

client($client)

Accessor of client object. See MozRepl::Client.

log($log)

Accessor of log object. See MozRepl::Log.

plugins($plugins)

Accessor of plugin table, key is plugin class name, value is plugin instance.

repl($repl)

Accessor of "repl" object name. If two or more connection to MozRepl, this name is added number on postfix like 'repl1'.

Accessor of search pathes. See new($args) in MozRepl.

log_class($class)

Logging class name. default value is "MozRepl::Log"

client_class($class)

Client class name. default value is "MozRepl::Client"

SEE ALSO

Top

MozRepl::Util
MozRepl::Plugin::Base
http://dev.hyperstruct.net/mozlab
http://dev.hyperstruct.net/mozlab/wiki/MozRepl

AUTHOR

Top

Toru Yamaguchi, <zigorou@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-mozrepl@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Top


MozRepl documentation  | view source Contained in the MozRepl distribution.