MozRepl::Plugin::Repl::Rename - Rename repl object name


MozRepl documentation Contained in the MozRepl distribution.

Index


Code Index:

NAME

Top

MozRepl::Plugin::Repl::Rename - Rename repl object name

VERSION

Top

version 0.01

SYNOPSIS

Top

    use MozRepl;

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

    $repl->repl_rename('zigorou');
    print $repl->execute("zigorou");

DESCRIPTION

Top

Add repl_rename() method to MozRepl.

METHODS

Top

execute($ctx, $args)

$ctx

Context object. See MozRepl

$args

Hash reference.

name

new repl object name.

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-rename@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::Rename;

use strict;
use warnings;

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

our $VERSION = '0.01';

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

    my $params = {};

    $params->{repl} = $ctx->repl;
    $params->{name} = MozRepl::Util->javascript_value($args->{name});

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

    $ctx->log->debug($command);

    my $prompt = "/" . $args->{name} . "> /";

    $ctx->client->prompt($prompt);
    $ctx->repl($args->{name});
    $ctx->execute($command);

    return 1;
}

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

__DATA__
__execute__
[% repl %].rename([% name %]);
__END__