MozRepl::Plugin::Repl::Inspect - Inspect specified javascript object.


MozRepl documentation Contained in the MozRepl distribution.

Index


Code Index:

NAME

Top

MozRepl::Plugin::Repl::Inspect - Inspect specified javascript object.

VERSION

Top

version 0.01

SYNOPSIS

Top

    use MozRepl;

    my $repl = MozRepl->new;
    $repl->setup({ plugins => { plugins => [qw/Repl::Inspect/] } });

    print $repl->repl_inspect({ source => 'window.getBrowser().contentWindow.location' });

DESCRIPTION

Top

Add repl_inspect() method to MozRepl.

METHODS

Top

execute($ctx, $args)

$ctx

Context object. See MozRepl.

$args

Hash reference.

source

Target object, default value is current context object. (optional) (Just do it same as repl.look())

name

Each properties prefix label. (optional)

max_depth

Limitation inspecting depth. (optional)

current_depth

Start inspecting depth. (optional)

SEE ALSO

Top

MozRepl::Plugin::Base

AUTHOR

Top

Toru Yamaguchi, <zigorou@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-mozrepl-plugin-repl-inspect@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 Contained in the MozRepl distribution.
package MozRepl::Plugin::Repl::Inspect;

use strict;
use warnings;

use base qw(MozRepl::Plugin::Base);

use MozRepl::Util;

our $VERSION = '0.01';

sub execute {
    my ($self, $ctx, $args) = @_;

    my $params = {};
    for (qw/max_depth name current_depth/) {
        $params->{$_} = MozRepl::Util->javascript_value($args->{$_});
    }

    $params->{source} = $args->{source} || sprintf("%s._workContext", $ctx->repl);
    $params->{repl} = $ctx->repl;

    my $command = $self->process('execute', $params);
    my @responses = $ctx->execute($command);

    return wantarray ? @responses : join("\n", @responses);
}

1; # End of MozRepl::Plugin::Repl::Inspect

__DATA__
__execute__
[% repl %].inspect([% source %], [% max_depth %], [% name %], [% current_depth %]);
__END__