File Coverage

blib/lib/BBS/Perm/Plugin/URI.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package BBS::Perm::Plugin::URI;
2              
3 1     1   36435 use warnings;
  1         2  
  1         30  
4 1     1   4 use strict;
  1         1  
  1         27  
5 1     1   5 use Carp;
  1         1  
  1         80  
6 1     1   406 use Gtk2;
  0            
  0            
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__