Perm/Plugin/URI.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Perm/Config.pm ↑ Summary Perm/Term.pm »
1 package BBS::Perm::Plugin::URI;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 0 ▶use Gtk2;
Subroutine BEGIN: called CC=1 SCAR=2.6
7  
8 my $cmd;
9 sub new {
10 my ( $class, %opt ) = @_;
11 $cmd = $opt{browser} || 'firefox -new-tab';
12 my $self = [undef];
13 bless $self, ref $class || $class;
14 return $self;
15 }
16  
17 sub browse {
18 my ( $self, $uri ) = @_;
19 if ($uri) {
20 system("$cmd \Q$uri\E &")
21 and warn 'can not run browser';
22 }
23 }
24  
25 sub push {
26 my ( $self, $input ) = @_;
27 return push @$self, $input;
28 }
29  
30 sub pop {
31 my $self = shift;
32 return pop @$self unless @$self == 1;
33 }
34  
35 sub uri {
36 my $self = shift;
37 return [ @{$self}[ 1 .. $#{$self} ] ];
38 }
39  
40 sub size {
41 return @{ shift->uri };
42 }
43  
44 sub clear {
45 my $self = shift;
46 splice @$self, 1;
47 }
48  
49 1;
50  
51 __END__
« Perm/Config.pm ↑ Summary Perm/Term.pm »