| MozRepl-Plugin-Restart documentation | Contained in the MozRepl-Plugin-Restart distribution. |
MozRepl::Plugin::Restart - Restart Firefox/Thunderbird
version 0.02
use MozRepl;
my $repl = MozRepl->new;
$repl->setup({ plugins => { plugins => [qw/Restart/] } });
$repl->restart; ### and restart your Firefox or Thunderbird
Add restart() method to MozRepl.
In the MDC Code snippets:Miscellaneous(http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Restarting_Firefox.2FThunderbird)
var nsIAppStartup = Components.interfaces.nsIAppStartup;
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eForceQuit | nsIAppStartup.eRestart);
MozRepl object (default "repl") has attribute "Ci" and "Cc". "Ci" is alias Components.interfaces, "Cc" is alias Components.classes. So restart script will be here,
(function(repl) {
var nsIAppStartup = repl.Ci.nsIAppStartup;
repl.Cc["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eForceQuit | nsIAppStartup.eRestart);
})(window.repl);
Context object. See MozRepl.
Hash reference.
Toru Yamaguchi, <zigorou@cpan.org>
Please report any bugs or feature requests to
bug-mozrepl-plugin-restart@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-Plugin-Restart documentation | Contained in the MozRepl-Plugin-Restart distribution. |
package MozRepl::Plugin::Restart; use strict; use warnings; use base qw(MozRepl::Plugin::Base);
our $VERSION = '0.02';
sub execute { my ($self, $ctx, $args) = @_; my $params = {}; $params->{repl} = $ctx->repl; my $command = $self->process('execute', $params); $ctx->log->warn("Restarting firefox/thunderbird ..."); $ctx->execute($command); return 1; }
1; # End of MozRepl::Plugin::Restart __DATA__ __execute__ ( function(repl) { var nsIAppStartup = repl.Ci.nsIAppStartup; repl.Cc["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eForceQuit | nsIAppStartup.eRestart); })([% repl %]); __END__