| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 2 | |||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||
| 4 | |||||||||||||||
| 5 | =head1 NAME | ||||||||||||||
| 6 | |||||||||||||||
| 7 | Quiq::XTerm - XTerminal Fenster | ||||||||||||||
| 8 | |||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||
| 10 | |||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||
| 12 | |||||||||||||||
| 13 | =cut | ||||||||||||||
| 14 | |||||||||||||||
| 15 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 16 | |||||||||||||||
| 17 | package Quiq::XTerm; | ||||||||||||||
| 18 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 19 | |||||||||||||||
| 20 | 1 | ▶ | use v5.10; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 21 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 22 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 23 | |||||||||||||||
| 24 | 1 | our $VERSION = '1.240'; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 1 | ▶ | use Quiq::Shell; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 27 | |||||||||||||||
| 28 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 29 | |||||||||||||||
| 30 | =head1 METHODS | ||||||||||||||
| 31 | |||||||||||||||
| 32 | =head2 Konstruktor | ||||||||||||||
| 33 | |||||||||||||||
| 34 | =head3 new() - Instantiiere XTerminal-Fenster-Objekt | ||||||||||||||
| 35 | |||||||||||||||
| 36 | =head4 Synopsis | ||||||||||||||
| 37 | |||||||||||||||
| 38 | $xtl = $class->new; | ||||||||||||||
| 39 | $xtl = $class->new($program); | ||||||||||||||
| 40 | |||||||||||||||
| 41 | =head4 Arguments | ||||||||||||||
| 42 | |||||||||||||||
| 43 | =over 4 | ||||||||||||||
| 44 | |||||||||||||||
| 45 | =item $program (Default: 'xterm') | ||||||||||||||
| 46 | |||||||||||||||
| 47 | X-Terminal-Programm. Mögliche Werte: 'xterm', 'gnome-terminal'. | ||||||||||||||
| 48 | |||||||||||||||
| 49 | =back | ||||||||||||||
| 50 | |||||||||||||||
| 51 | =head4 Description | ||||||||||||||
| 52 | |||||||||||||||
| 53 | Instantiiere ein X-Terminal-Fenster-Objekt und liefere eine | ||||||||||||||
| 54 | Referenz auf dieses Objekt zurück. | ||||||||||||||
| 55 | |||||||||||||||
| 56 | =cut | ||||||||||||||
| 57 | |||||||||||||||
| 58 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 59 | |||||||||||||||
| 60 | 0 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||
| 61 | 0 | my $class = shift; | |||||||||||||
| 62 | 0 | ▶ | my $program = shift || 'xterm'; | ||||||||||||
|
Condition0%0/2
shift() || 'xterm'
MC/DC0%0/1
shift() || 'xterm'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||
| 63 | |||||||||||||||
| 64 | 0 | ▶ | if ($program !~ /^(xterm|gnome-terminal)$/) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 65 | 0 | $class->throw( | |||||||||||||
| 66 | 'XTERM-00001: Unknown terminal type', | ||||||||||||||
| 67 | Type => $program, | ||||||||||||||
| 68 | ); | ||||||||||||||
| 69 | } | ||||||||||||||
| 70 | |||||||||||||||
| 71 | 0 | return $class->SUPER::new( | |||||||||||||
| 72 | program => $program, | ||||||||||||||
| 73 | ); | ||||||||||||||
| 74 | } | ||||||||||||||
| 75 | |||||||||||||||
| 76 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 77 | |||||||||||||||
| 78 | =head2 Attributmethoden | ||||||||||||||
| 79 | |||||||||||||||
| 80 | =head3 program() - Name des X-Terminals | ||||||||||||||
| 81 | |||||||||||||||
| 82 | =head4 Synopsis | ||||||||||||||
| 83 | |||||||||||||||
| 84 | $program = $xtl->program; | ||||||||||||||
| 85 | |||||||||||||||
| 86 | =head4 Returns | ||||||||||||||
| 87 | |||||||||||||||
| 88 | String | ||||||||||||||
| 89 | |||||||||||||||
| 90 | =head4 Description | ||||||||||||||
| 91 | |||||||||||||||
| 92 | Liefere den Namen des X-Terminal-Programms (siehe Konstruktor) zurück. | ||||||||||||||
| 93 | |||||||||||||||
| 94 | =head2 Objektmethoden | ||||||||||||||
| 95 | |||||||||||||||
| 96 | =head3 launch() - Öffne X-Term und führe Kommando aus | ||||||||||||||
| 97 | |||||||||||||||
| 98 | =head4 Synopsis | ||||||||||||||
| 99 | |||||||||||||||
| 100 | $xtl->launch($x,$y,$width,$height,$cmdLine); | ||||||||||||||
| 101 | |||||||||||||||
| 102 | =head4 Arguments | ||||||||||||||
| 103 | |||||||||||||||
| 104 | =over 4 | ||||||||||||||
| 105 | |||||||||||||||
| 106 | =item $x | ||||||||||||||
| 107 | |||||||||||||||
| 108 | X-Koordinate des Fensters. | ||||||||||||||
| 109 | |||||||||||||||
| 110 | =item $y | ||||||||||||||
| 111 | |||||||||||||||
| 112 | X-Koordinate des Fensters. | ||||||||||||||
| 113 | |||||||||||||||
| 114 | =item $width | ||||||||||||||
| 115 | |||||||||||||||
| 116 | Breite des Fensters in Zeichen. | ||||||||||||||
| 117 | |||||||||||||||
| 118 | =item $height | ||||||||||||||
| 119 | |||||||||||||||
| 120 | Höhe des Fensters in Zeichen. | ||||||||||||||
| 121 | |||||||||||||||
| 122 | =item $cmdLine | ||||||||||||||
| 123 | |||||||||||||||
| 124 | Kommandozeile des Programms, das gestartet werden soll. | ||||||||||||||
| 125 | |||||||||||||||
| 126 | =back | ||||||||||||||
| 127 | |||||||||||||||
| 128 | =cut | ||||||||||||||
| 129 | |||||||||||||||
| 130 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 131 | |||||||||||||||
| 132 | 0 | ▶ | sub launch { | ||||||||||||
|
Subroutine
launch: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||
| 133 | 0 | my ($self,$x,$y,$width,$height,$cmdLine) = @_; | |||||||||||||
| 134 | |||||||||||||||
| 135 | 0 | my $program = $self->program; | |||||||||||||
| 136 | |||||||||||||||
| 137 | 0 | my $cmd = $program; | |||||||||||||
| 138 | 0 | ▶ | if ($program eq 'xterm') { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 139 | 0 | $cmd .= " -geometry ${width}x${height}+$x+$y"; | |||||||||||||
| 140 | } | ||||||||||||||
| 141 | elsif ($program eq 'gnome-terminal') { | ||||||||||||||
| 142 | 0 | $cmd .= " --geometry=${width}x${height}+$x+$y"; | |||||||||||||
| 143 | } | ||||||||||||||
| 144 | |||||||||||||||
| 145 | # $cmd .= qq| -e "`launch $cmdLine`"|; | ||||||||||||||
| 146 | 0 | $cmd .= qq| -e "$cmdLine"|; | |||||||||||||
| 147 | |||||||||||||||
| 148 | 0 | Quiq::Shell->exec("$cmd &",log=>1); | |||||||||||||
| 149 | |||||||||||||||
| 150 | 0 | return; | |||||||||||||
| 151 | } | ||||||||||||||
| 152 | |||||||||||||||
| 153 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 154 | |||||||||||||||
| 155 | =head1 VERSION | ||||||||||||||
| 156 | |||||||||||||||
| 157 | 1.240 | ||||||||||||||
| 158 | |||||||||||||||
| 159 | =head1 AUTHOR | ||||||||||||||
| 160 | |||||||||||||||
| 161 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||
| 162 | |||||||||||||||
| 163 | =head1 COPYRIGHT | ||||||||||||||
| 164 | |||||||||||||||
| 165 | Copyright (C) 2026 Frank Seitz | ||||||||||||||
| 166 | |||||||||||||||
| 167 | =head1 LICENSE | ||||||||||||||
| 168 | |||||||||||||||
| 169 | This code is free software; you can redistribute it and/or modify | ||||||||||||||
| 170 | it under the same terms as Perl itself. | ||||||||||||||
| 171 | |||||||||||||||
| 172 | =cut | ||||||||||||||
| 173 | |||||||||||||||
| 174 | # ----------------------------------------------------------------------------- | ||||||||||||||
| 175 | |||||||||||||||
| 176 | 1 | 1; | |||||||||||||
| 177 | |||||||||||||||
| 178 | # eof | ||||||||||||||