| 1 | package Termux::API; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = 0.03; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | sub new { | ||||||||||||||||||||||||||||
| 9 | 0 | ▶ | return bless( { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 10 | j => JSON->new | ||||||||||||||||||||||||||||
| 11 | }, $_[0] ); | ||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub command { | ||||||||||||||||||||||||||||
| 15 | 0 | ▶ | my $command = qx($_[1]); | ||||||||||||||||||||||||||
|
Subroutine
command: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | return eval { $_[0]->{j}->decode($command) } || $command; | ||||||||||||||||||||||||||
|
Condition0%0/3
eval {
do {
$_[0]{'j'}->decode($command)
}
} || $command
MC/DC0%0/2
eval {
do {
$_[0]{'j'}->decode($command)
}
} || $command
eval {
do {
$_[0]{'j'}->decode($command)
}
}
$command
Truth table0%0/3
A || B
A= eval {
do {
$_[0]{'j'}->decode($command)
}
}B= $command
| |||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub battery_status { | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | $_[0]->command('termux-battery-status'); | ||||||||||||||||||||||||||
|
Subroutine
battery_status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | sub brightness { | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $_[0]->command("termux-brightness $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
brightness: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub camera_info { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $_[0]->command('termux-camera-info'); | ||||||||||||||||||||||||||
|
Subroutine
camera_info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub clipboard_get { | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | $_[0]->command('termux-clipboard-get'); | ||||||||||||||||||||||||||
|
Subroutine
clipboard_get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub clipboard_set { | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | $_[0]->command("termux-clipboard-set $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
clipboard_set: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub contact_list { | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $_[0]->command('termux-contact-list'); | ||||||||||||||||||||||||||
|
Subroutine
contact_list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub dialog { | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my ( $self, $type, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
dialog: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | my $command = sprintf( 'termux-dialog %s %s', | ||||||||||||||||||||||||||||
| 46 | $type, | ||||||||||||||||||||||||||||
| 47 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | sub download { | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $_[0]->command("termux-download $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
download: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub fingerprint { | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $_[0]->command('termux-fingerprint'); | ||||||||||||||||||||||||||
|
Subroutine
fingerprint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub infrared_frequencies { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $_[0]->command('termux-infrared-frequencies'); | ||||||||||||||||||||||||||
|
Subroutine
infrared_frequencies: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | sub infrared_transmit { | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $_[0]->command("termux-infrared-transmit -f $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
infrared_transmit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | sub location { | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | my ( $self, $provide, $request ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
location: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | $provide ||= 'gps'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$provide ||= "gps"
MC/DC0%0/1
$provide ||= "gps"
$provide
Truth table0%0/2
A
A= $provide
| |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | $request ||= 'once'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$request ||= "once"
MC/DC0%0/1
$request ||= "once"
$request
Truth table0%0/2
A
A= $request
| |||||||||||||||||||||||||||||
| 72 | 0 | $_[0]->command("termux-location -p $provide -r $request"); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub microphone { | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my ( $self, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
microphone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 77 | my $command = sprintf( 'termux-microphone-record %s', | ||||||||||||||||||||||||||||
| 78 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||
| 80 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | sub notification { | ||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my ( $self, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
notification: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 85 | my $command = sprintf( 'termux-notification %s', | ||||||||||||||||||||||||||||
| 86 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||
| 88 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | sub notification_remove { | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $_[0]->command("termux-notification-remove $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
notification_remove: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | sub sensor { | ||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my ( $self, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
sensor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 97 | 0 | $options{'-n'} = 1; | |||||||||||||||||||||||||||
| 98 | my $command = sprintf( 'termux-sensor %s', | ||||||||||||||||||||||||||||
| 99 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||
| 101 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | sub telephony_call { | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $_[0]->command("termux-telephony-call $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
telephony_call: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | sub telephony_cellinfo { | ||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $_[0]->command('termux-telephony-cellinfo'); | ||||||||||||||||||||||||||
|
Subroutine
telephony_cellinfo: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | sub telephony_device { | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $_[0]->command('termux-telephony-deviceinfo'); | ||||||||||||||||||||||||||
|
Subroutine
telephony_device: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | sub toast { | ||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my ( $self, $text, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
toast: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 118 | my $command = sprintf( | ||||||||||||||||||||||||||||
| 119 | 'termux-toast %s "%s"', | ||||||||||||||||||||||||||||
| 120 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ), | |||||||||||||||||||||||||||
| 121 | $text | ||||||||||||||||||||||||||||
| 122 | ); | ||||||||||||||||||||||||||||
| 123 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | sub torch { | ||||||||||||||||||||||||||||
| 127 | 0 | ▶ | $_[0]->command("termux-torch $_[1]"); | ||||||||||||||||||||||||||
|
Subroutine
torch: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | sub tts_engines { | ||||||||||||||||||||||||||||
| 131 | 0 | ▶ | $_[0]->command('termux-tts-engines'); | ||||||||||||||||||||||||||
|
Subroutine
tts_engines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | sub tts_speak { | ||||||||||||||||||||||||||||
| 135 | 0 | ▶ | my ( $self, $text, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
tts_speak: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 136 | my $command = sprintf( | ||||||||||||||||||||||||||||
| 137 | 'termux-tts-speak %s "%s"', | ||||||||||||||||||||||||||||
| 138 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ), | |||||||||||||||||||||||||||
| 139 | $text | ||||||||||||||||||||||||||||
| 140 | ); | ||||||||||||||||||||||||||||
| 141 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub vibrate { | ||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my ( $self, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
vibrate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | my $command = sprintf( 'termux-vibrate %s', | ||||||||||||||||||||||||||||
| 147 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||
| 149 | 0 | $_[0]->command($command); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | sub volume { | ||||||||||||||||||||||||||||
| 153 | 0 | ▶ | my ( $self, $stream, $volume ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
volume: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 154 | 0 | my $command = 'termux-volume'; | |||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ( $stream and $volume ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$stream and $volume
MC/DC0%0/2
$stream and $volume
$stream
$volume
Truth table0%0/3
A and B
A= $streamB= $volume
| |||||||||||||||||||||||||||||
| 156 | 0 | $command = sprintf( '%s %s %s', $command, $stream, $volume ); | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | 0 | $self->command($command); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | sub wallpaper { | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my ( $self, %options ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
wallpaper: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 163 | my $command = sprintf( 'termux-wallpaper %s', | ||||||||||||||||||||||||||||
| 164 | 0 | join( ' ', map( { $_ . ' "' . $options{$_} . '"'; } keys %options ) ) | |||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||
| 166 | 0 | $self->command($command); | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | sub wifi { | ||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $_[0]->command('termux-wifi-connectioninfo'); | ||||||||||||||||||||||||||
|
Subroutine
wifi: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | sub wifi_enable { | ||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $enable = $_[1] ? 'true' : 'false'; | ||||||||||||||||||||||||||
|
Subroutine
wifi_enable: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 175 | 0 | $_[0]->command("termux-wifi-enable $enable"); | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | sub wifi_scan { | ||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $_[0]->command('termux-wifi-scaninfo'); | ||||||||||||||||||||||||||
|
Subroutine
wifi_scan: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | sub audio_info { | ||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $_[0]->command('termux-audio-info'); | ||||||||||||||||||||||||||
|
Subroutine
audio_info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | sub elf_cleaner { | ||||||||||||||||||||||||||||
| 187 | 0 | ▶ | my ($self, @files) = @_; | ||||||||||||||||||||||||||
|
Subroutine
elf_cleaner: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 0 | $self->command(sprintf 'termux-elf-cleaner %s', join ' ', @files); | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | sub speech_to_text { | ||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $_[0]->command(sprintf( | ||||||||||||||||||||||||||
|
Subroutine
speech_to_text: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 'termux-speech-to-text %s', | ||||||||||||||||||||||||||||
| 194 | $_[1] ? '-p' : '' | ||||||||||||||||||||||||||||
| 195 | )); | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 1 | 1; | |||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | __END__ | ||||||||||||||||||||||||||||