MozRepl::Plugin::Repl::Search - The fantastic new MozRepl::Plugin::Repl::Search!


MozRepl documentation Contained in the MozRepl distribution.

Index


Code Index:

NAME

Top

MozRepl::Plugin::Repl::Search - The fantastic new MozRepl::Plugin::Repl::Search!

VERSION

Top

version 0.01

SYNOPSIS

Top

    use MozRepl;

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

    my @results = $repl->repl_search({
      pattern => '^getElement',
      context => 'document'
    });
    print join("\n", @results);

DESCRIPTION

Top

Add repl_search() method to MozRepl.

METHODS

Top

Search properties by regex on specified context.

execute($ctx, $args)

$ctx

Context object. See MozRepl.

$args

Hash reference.

context

Context variable or value.

pattern

Search pattern string.

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-search@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::Search;

use strict;
use warnings;

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

our $VERSION = '0.01';

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

    $args->{context} ||= "this";
    $args->{repl} = $ctx->repl;

    my $cmd = $self->process('execute', $args);
    my @result = $ctx->execute($cmd);

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

1; # End of MozRepl::Plugin::Repl::Search
__DATA__
__execute__
[% repl %].search([% pattern %], [% context %]);
__END__