| MozRepl documentation | Contained in the MozRepl distribution. |
MozRepl::Plugin::Repl::Print - Print value
version 0.01
use MozRepl;
my $repl = MozRepl->new;
$repl->setup({ plugins => { plugins => [qw/Repl::Print/] } });
print $repl->repl_print("Kyoshinhei ga do-n!!!"); ### Kyoshinhei ga do-n!!!
Add repl_print() method to MozRepl.
Print value.
Context object. See MozRepl.
Hash reference.
Javascript variable or value.
Include newline(\n). default true.
Toru Yamaguchi, <zigorou@cpan.org>
Please report any bugs or feature requests to
bug-mozrepl-plugin-repl-print@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 2007 Toru Yamaguchi, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| MozRepl documentation | Contained in the MozRepl distribution. |
package MozRepl::Plugin::Repl::Print; use strict; use warnings; use base qw(MozRepl::Plugin::Base);
our $VERSION = '0.01';
sub execute { my ($self, $ctx, $args) = @_; my $params = {}; $params->{source} = $args->{source}; $params->{newline} = (defined $args->{newline}) ? ($args->{newline} ? "true" : "false") : "undefined"; $params->{repl} = $ctx->repl; my $command = $self->process('execute', $params); my @responses = $ctx->execute($command); return join("\n", @responses); }
1; # End of MozRepl::Plugin::Repl::Print __DATA__ __execute__ [% repl %].print([% source %], [% newline %]); __END__