File Coverage

blib/lib/X11/Terminal/GnomeTerminal.pm
Criterion Covered Total %
statement 11 11 100.0
branch 4 4 100.0
condition n/a
subroutine 3 3 100.0
pod 2 2 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package X11::Terminal::GnomeTerminal;
2              
3 2     2   71073 use Moose;
  2         464865  
  2         14  
4             extends 'X11::Terminal';
5              
6             our $VERSION = 1.0.0;
7              
8             =head1 NAME
9              
10             X11::Terminal::GnomeTerminal - Create customised gnome-terminal windows
11              
12             =head1 SYNOPSIS
13              
14             This module provides an object interface to launching gnome-terminal windows.
15              
16             use X11::Terminal::GnomeTerminal;
17              
18             my $t1 = X11::Terminal::GnomeTerminal->new();
19             my $t2 = X11::Terminal::GnomeTerminal->new(host => "remoteserver");
20             my $t3 = X11::Terminal::GnomeTerminal->new(profile => "special");
21              
22             for ( $t1, $t2, $t3 ) {
23             $_->launch();
24             }
25              
26              
27             =head1 CONSTRUCTOR
28              
29             =over 4
30              
31             =item X11::Terminal::GnomeTerminal->new(%attr);
32              
33             Create a new GnomeTerminal object, optionally with the specified attributes
34             (see below).
35              
36             =back
37              
38              
39             =head1 ATTRIBUTES
40              
41             Each of the following attributes provide an accessor method, but they can
42             also be set in the constructor.
43              
44             =over 4
45            
46             =item host
47              
48             Specifies the remote host to log in to (using ssh).
49              
50             =item agentforward
51              
52             If the host has been specified, and agentforward is true, the login to that
53             host will use SSH Agent Forwarding.
54              
55             =item xforward
56              
57             If the host has been specified, and xforward is true, the login to that host
58             will use SSH X Forwarding.
59              
60             =item profile
61              
62             Set the GnomeTerminal window profile name
63              
64             =item geometry
65              
66             Set the preferred size and position of the GnomeTerminal window
67              
68             =back
69              
70              
71             =head1 OTHER METHODS
72              
73             =over 4
74              
75             =item launch($debug);
76              
77             Calculates (and returns) the command that will launch your gnome-terminal.
78             It also runs that command in a child process - unless $debug is specified.
79              
80             =item terminalArgs();
81              
82             Return the arguments that will be passed to the gnome-terminal. This will
83             provide the customisations. There should be no reason to call this method
84             directly.
85             =cut
86              
87             sub terminalArgs {
88 22     22 1 42 my ($self) = @_;
89              
90 22         34 my $args = "";
91 22 100       500 if ( my $name = $self->profile() ) {
92 3         9 $args .= " --window-with-profile=$name";
93             }
94 22 100       569 if ( my $geo = $self->geometry() ) {
95 3         8 $args .= " -geometry $geo";
96             }
97 22         59 return "$args";
98             }
99              
100             =item terminalName();
101              
102             Returns the name of the executable program that we want to run. There
103             should be no reason to call this method directly.
104             =cut
105              
106             sub terminalName {
107 23     23 1 2701 return "gnome-terminal";
108             }
109              
110             =back
111              
112             =head1 SEE ALSO
113              
114             L<X11::Terminal>
115              
116             =head1 COPYRIGHT
117              
118             Copyright 2010-2011 Evan Giles.
119              
120             This module is free software; you can redistribute it and/or modify it
121             under the same terms as Perl itself.
122             =cut
123              
124             1; # End of X11::Terminal::GnomeTerminal