Plagger/Plugin/Notify/OpenBrowser/FirefoxRemote.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
init
2.0
open
2.0
BEGIN
2.0
CRAP 2.0
1 package Plagger::Plugin::Notify::OpenBrowser::FirefoxRemote;
2 use base qw( Plagger::Plugin::Notify::OpenBrowser );
3  
4 use strict;
5 use Net::Telnet;
6  
7 sub init {
8 my $self = shift;
9 $self->Plagger::Plugin::init(@_); # Don't call SUPER::init which does auto-dispatch
10 }
11  
12 sub open {
13 my($self, $link) = @_;
14  
15 $self->{conn} ||= do {
16 my $host = $self->conf->{host} || "localhost";
17 my $port = $self->conf->{port} || 4242;
18 my $telnet = Net::Telnet->new(Port => $port);
19 $telnet->open($host)
20 or return $self->log(error => "Can't connect to $host:$port");
21 $self->log(info => "Connect MozRepl at $host:$port");
22 $telnet;
23 };
24  
25 $self->log(info => "Open $link in a remote Firefox");
26 $self->{conn}->cmd("window.openNewTabWith('$link')");
27 }
28  
29 1;
30  
31 __END__