| MozRepl documentation | Contained in the MozRepl distribution. |
MozRepl::Plugin::Repl::Load - Load external script
version 0.01
use MozRepl;
my $repl = MozRepl->new;
$repl->setup({ plugins => { plugins => [qw/Repl::Load/] } });
$repl->repl_load({
uri => q|http://json.org/json.js|
});
print $repl->execute("String.prototype.toJSONString;");
Add repl_load() method to MozRepl.
Load external script
Context object. See MozRepl.
Hash reference.
External script location.
Default undefined.
Toru Yamaguchi, <zigorou@cpan.org>
Please report any bugs or feature requests to
bug-mozrepl-plugin-repl-load@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::Load; 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 = {}; $params->{repl} = $ctx->repl; $params->{uri} = MozRepl::Util->javascript_value(MozRepl::Util->javascript_uri($args->{uri})); $params->{context} ||= MozRepl::Util->javascript_value(undef); my $command = $self->process('execute', $params); $ctx->execute($command); return 1; }
1; # End of MozRepl::Plugin::Repl::Load __DATA__ __execute__ [% repl %].load([% uri %], [% context %]); __END__