line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -I/home/phil/perl/cpan/DataTableText/lib -I/home/phil/perl/cpan/JavaDoc/lib -I/home/phil/perl/cpan/DitaPCD/lib/ -I/home/phil/perl/cpan/DataEditXml/lib/ -I/home/phil/perl/cpan/GitHubCrud/lib/ -I/home/phil/perl/cpan/DataDFA/lib/ -I/home/phil/perl/cpan/DataNFA/lib/ -I//home/phil/perl/cpan/PreprocessOps/lib/ |
2
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
3
|
|
|
|
|
|
|
# Make with Perl |
4
|
|
|
|
|
|
|
# Philip R Brenan at gmail dot com, Appa Apps Ltd, 2017 |
5
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
6
|
|
|
|
|
|
|
package MakeWithPerl; |
7
|
|
|
|
|
|
|
our $VERSION = "20210534"; |
8
|
|
|
|
|
|
|
use warnings FATAL => qw(all); |
9
|
|
|
|
|
|
|
use strict; |
10
|
|
|
|
|
|
|
use Carp qw(confess); |
11
|
|
|
|
|
|
|
use Data::Dump qw(dump); |
12
|
|
|
|
|
|
|
use Data::Table::Text qw(:all); |
13
|
|
|
|
|
|
|
use Getopt::Long; |
14
|
|
|
|
|
|
|
use utf8; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
0
|
518
|
sub mwpl {qq(makeWithPerlLocally.pl)} # Make with Perl locally |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $javaHome; # Location of java files |
19
|
|
|
|
|
|
|
my $cIncludes; # C includes folder |
20
|
|
|
|
|
|
|
my $compile; # Compile |
21
|
|
|
|
|
|
|
my $coverage; # Get coverage of code |
22
|
|
|
|
|
|
|
my $doc; # Documentation |
23
|
|
|
|
|
|
|
my $gccVersion; # Alternate version of gcc is set. Example: --gccVersion gcc-10 |
24
|
|
|
|
|
|
|
my $htmlToPdf; # Convert html to pdf |
25
|
|
|
|
|
|
|
my $run; # Run |
26
|
|
|
|
|
|
|
my $upload; # Upload files |
27
|
|
|
|
|
|
|
my $valgrind; # Check C memory usage |
28
|
|
|
|
|
|
|
my $xmlCatalog; # Verify xml |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
sub makeWithPerl { # Make a file |
31
|
1
|
|
|
1
|
0
|
6
|
GetOptions( |
32
|
|
|
|
|
|
|
'cIncludes=s' =>\$cIncludes, |
33
|
|
|
|
|
|
|
'compile' =>\$compile, |
34
|
|
|
|
|
|
|
'coverage' =>\$coverage, |
35
|
|
|
|
|
|
|
'doc' =>\$doc, |
36
|
|
|
|
|
|
|
'gccVersion=s'=>\$gccVersion, |
37
|
|
|
|
|
|
|
'htmlToPdf' =>\$htmlToPdf, |
38
|
|
|
|
|
|
|
'run' =>\$run, |
39
|
|
|
|
|
|
|
'valgrind' =>\$valgrind, |
40
|
|
|
|
|
|
|
'upload' =>\$upload, |
41
|
|
|
|
|
|
|
'xmlCatalog=s'=>\$xmlCatalog, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
1
|
0
|
0
|
|
|
48
|
unless($compile or $run or $doc or $upload) # Check action |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
45
|
1
|
|
|
|
|
6
|
{confess "Specify --compile or --run or --doc or --upload"; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
0
|
|
|
1
|
my $file = shift @ARGV // $0; # File to process |
49
|
|
|
|
|
|
|
|
50
|
1
|
0
|
|
|
|
30
|
unless($file) # Confirm we have a file |
51
|
1
|
|
|
|
|
6
|
{confess "Use %f to specify the file to process"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
0
|
|
|
|
1
|
if (! -e $file) # No such file |
55
|
1
|
|
|
|
|
75
|
{confess "No such file:\n$file" |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
1
|
0
|
|
|
|
495
|
if ($upload) # Upload files to GitHub |
59
|
1
|
|
|
|
|
7046
|
{my @d = split m{/}, $file; # Split file name |
60
|
1
|
|
|
|
|
89
|
pop @d; |
61
|
1
|
|
|
|
|
3627
|
while(@d) # Look for a folder that contains a push command |
62
|
1
|
|
|
|
|
125260
|
{my $u = "/".fpe(@d, qw(pushToGitHub pl)); |
63
|
1
|
0
|
|
|
|
1677
|
if (-e $u) |
64
|
1
|
|
|
|
|
894
|
{say STDERR $u; |
65
|
1
|
|
|
|
|
9238
|
qx(perl $u); |
66
|
1
|
|
|
|
|
5
|
exit; |
67
|
|
|
|
|
|
|
} |
68
|
1
|
|
|
|
|
183
|
pop @d; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
2
|
confess "Unable to find pushToGitHub in folders down to $file"; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
1
|
0
|
|
|
|
8
|
if ($doc) # Documentation |
74
|
1
|
0
|
|
|
|
2556
|
{if ($file =~ m((pl|pm)\Z)s) # Document perl |
|
|
0
|
|
|
|
|
|
75
|
1
|
|
|
|
|
2
|
{say STDERR "Document perl $file"; |
76
|
1
|
|
|
|
|
49
|
updatePerlModuleDocumentation($file); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
elsif ($file =~ m((java)\Z)s) # Document java |
79
|
1
|
|
|
|
|
7
|
{say STDERR "Document java $file"; |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
2
|
my %files; |
82
|
1
|
|
|
|
|
251
|
for(findFiles($javaHome)) |
83
|
1
|
0
|
0
|
|
|
558
|
{next if m/Test\.java\Z/ or m(/java/z/); # Exclude test files and /java/ sub folders |
84
|
1
|
0
|
|
|
|
73189
|
$files{$_}++ if /\.java\Z/ |
85
|
|
|
|
|
|
|
} |
86
|
1
|
|
|
|
|
7
|
confess; |
87
|
|
|
|
|
|
|
#my $j = Java::Doc::new; |
88
|
|
|
|
|
|
|
#$j->source = [sort keys %files]; |
89
|
|
|
|
|
|
|
#$j->target = my $f = filePathExt($javaHome, qw(documentation html)); |
90
|
|
|
|
|
|
|
#$j->indent = 20; |
91
|
|
|
|
|
|
|
#$j->colors = [map {"#$_"} qw(ccFFFF FFccFF FFFFcc CCccFF FFCCcc ccFFCC)]; |
92
|
|
|
|
|
|
|
#$j->html; |
93
|
|
|
|
|
|
|
#qx(opera $f); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
else |
96
|
1
|
|
|
|
|
34243
|
{confess "Unable to document file $file"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
exit |
99
|
1
|
|
|
|
|
3
|
} |
100
|
|
|
|
|
|
|
|
101
|
1
|
0
|
0
|
|
|
9
|
if (-e mwpl and $run) # Make with Perl locally |
102
|
0
|
|
|
|
|
0
|
{my $p = join ' ', @ARGV; |
103
|
0
|
|
|
|
|
0
|
my $c = mwpl; |
104
|
0
|
|
|
|
|
0
|
print STDERR qx(perl -CSDA $c $p); |
105
|
0
|
|
|
|
|
0
|
exit; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.p[lm]\Z)) # Perl |
109
|
0
|
0
|
|
|
|
0
|
{if ($compile) # Syntax check perl |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
110
|
0
|
|
|
|
|
0
|
{print STDERR qx(perl -CSDA -cw "$file"); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
elsif ($run) # Run perl |
113
|
0
|
0
|
|
|
|
0
|
{if ($file =~ m(.cgi\Z)s) # Run from web server |
114
|
0
|
|
|
|
|
0
|
{&cgiPerl($file); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
else # Run from command line |
117
|
0
|
|
|
|
|
0
|
{say STDERR qq(perl -CSDA -w "$file"); |
118
|
0
|
|
|
|
|
0
|
print STDERR qx(perl -CSDA -w "$file"); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
elsif ($doc) # Document perl |
122
|
0
|
|
|
|
|
0
|
{say STDERR "Document perl $file"; |
123
|
0
|
|
|
|
|
0
|
updatePerlModuleDocumentation($file); |
124
|
|
|
|
|
|
|
} |
125
|
0
|
|
|
|
|
0
|
exit; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.(dita|ditamap|xml)\Z)) # Process xml |
129
|
0
|
|
|
|
|
0
|
{my $source = readFile($file); |
130
|
0
|
|
|
|
|
0
|
my $C = $xmlCatalog; |
131
|
0
|
|
|
|
|
0
|
my $c = qq(xmllint --noent --noout "$file" && echo "Parses OK!" && export XML_CATALOG_FILES=$C && xmllint --noent --noout --valid - < "$file" && echo Valid); |
132
|
0
|
|
|
|
|
0
|
say STDERR $c; |
133
|
0
|
|
|
|
|
0
|
say STDERR qx($c); |
134
|
0
|
|
|
|
|
0
|
exit; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.asm\Z)) # Process assembler |
138
|
0
|
|
|
|
|
0
|
{my $o = setFileExtension $file, q(o); |
139
|
0
|
|
|
|
|
0
|
my $e = setFileExtension $file; |
140
|
0
|
|
|
|
|
0
|
my $l = setFileExtension $file, q(txt); |
141
|
0
|
|
|
|
|
0
|
my $c = qq(nasm -f elf64 -g -l $l -o $o $file); |
142
|
0
|
0
|
|
|
|
0
|
if ($compile) |
143
|
0
|
|
|
|
|
0
|
{say STDERR $c; |
144
|
0
|
|
|
|
|
0
|
say STDERR qx($c; cat $l); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
else |
147
|
0
|
|
|
|
|
0
|
{$c = "$c; ld -o $e $o; $e"; |
148
|
0
|
|
|
|
|
0
|
say STDERR $c; |
149
|
0
|
|
|
|
|
0
|
say STDERR qx($c); |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
|
|
0
|
exit; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.cp*\Z)) # GCC |
155
|
0
|
|
|
|
|
0
|
{my $cp = join ' ', map {split /\s+/} grep {!/\A#/} split /\n/, <
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
156
|
|
|
|
|
|
|
-finput-charset=UTF-8 -fmax-errors=7 -rdynamic |
157
|
|
|
|
|
|
|
-Wall -Wextra -Wno-unused-function |
158
|
|
|
|
|
|
|
END |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
0
|
|
|
0
|
my $gcc = $gccVersion // 'gcc'; # Gcc version 10 |
161
|
0
|
0
|
|
|
|
0
|
if ($compile) |
162
|
0
|
|
|
|
|
0
|
{my $cmd = qq($gcc $cp -c "$file" -o /dev/null); # Syntax check |
163
|
0
|
|
|
|
|
0
|
say STDERR $cmd; |
164
|
0
|
|
|
|
|
0
|
print STDERR $_ for qx($cmd); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
else |
167
|
0
|
|
|
|
|
0
|
{my $e = $file =~ s(\.cp?p?\Z) ()gsr; # Execute |
168
|
0
|
|
|
|
|
0
|
my $o = fpe($e, q(o)); # Object file |
169
|
0
|
|
|
|
|
0
|
unlink $e, $o; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
my $c = qq($gcc $cp -o "$e" "$file" && $e); # Compile and run |
172
|
0
|
|
|
|
|
0
|
lll qq($c); |
173
|
0
|
|
|
|
|
0
|
lll qx($c); |
174
|
0
|
|
|
|
|
0
|
unlink $o; |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
0
|
if ($valgrind) # Valgrind requested |
177
|
0
|
|
|
|
|
0
|
{my $c = qq(valgrind --leak-check=full --leak-resolution=high --show-leak-kinds=definite --track-origins=yes $e 2>&1); |
178
|
0
|
|
|
|
|
0
|
lll qq($c); |
179
|
0
|
|
|
|
|
0
|
my $result = qx($c); |
180
|
0
|
|
|
|
|
0
|
lll $result; |
181
|
0
|
0
|
|
|
|
0
|
exit(1) unless $result =~ m(ERROR SUMMARY: 0 errors from 0 contexts); |
182
|
0
|
|
|
|
|
0
|
lll "SUCCESS: no memory leaks" |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
} |
185
|
0
|
|
|
|
|
0
|
exit; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.js\Z)) # Javascript |
189
|
0
|
0
|
|
|
|
0
|
{if ($compile) |
190
|
0
|
|
|
|
|
0
|
{say STDERR "Compile javascript $file"; |
191
|
0
|
|
|
|
|
0
|
print STDERR qx(nodejs -c "$file"); # Syntax check javascript |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
else |
194
|
0
|
|
|
|
|
0
|
{my $c = qq(nodejs --max_old_space_size=4096 "$file"); # Run javascript |
195
|
0
|
|
|
|
|
0
|
say STDERR $c; |
196
|
0
|
|
|
|
|
0
|
print STDERR qx($c); |
197
|
0
|
|
|
|
|
0
|
say STDERR q(); |
198
|
|
|
|
|
|
|
} |
199
|
0
|
|
|
|
|
0
|
exit; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.sh\Z)) # Bash script |
203
|
0
|
0
|
|
|
|
0
|
{if ($compile) |
204
|
0
|
|
|
|
|
0
|
{say STDERR "Test bash $file"; |
205
|
0
|
|
|
|
|
0
|
print STDERR qx(bash -x "$file"); # Debug bash |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
else |
208
|
0
|
|
|
|
|
0
|
{print STDERR qx(bash "$file"); # Bash |
209
|
|
|
|
|
|
|
} |
210
|
0
|
|
|
|
|
0
|
exit; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.adblog\Z)) # Android log |
214
|
0
|
|
|
|
|
0
|
{my $adb = q(/home/phil/android/sdk/platform-tools/adb); |
215
|
0
|
|
|
|
|
0
|
my $c = qq($adb -e logcat "*:W" -d > $file && $adb -e logcat -c); |
216
|
0
|
|
|
|
|
0
|
say STDERR "Android log\n$c"; |
217
|
0
|
|
|
|
|
0
|
print STDERR qx($c); |
218
|
0
|
|
|
|
|
0
|
exit; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.java\Z)) # Java |
222
|
0
|
|
|
|
|
0
|
{my ($name, undef, $ext) = fileparse($file, qw(.java)); # Parse file name |
223
|
0
|
|
|
|
|
0
|
my $package = &getPackageNameFromFile($file); # Get package name |
224
|
0
|
|
|
|
|
0
|
my $cp = fpd($javaHome, qw(Classes)); # Folder containing java classes |
225
|
0
|
0
|
|
|
|
0
|
if ($compile) # Compile |
226
|
0
|
|
|
|
|
0
|
{my $c = "javac -g -d $cp -cp $cp -Xlint -Xdiags:verbose $file -Xmaxerrs 99";# Syntax check Java |
227
|
0
|
|
|
|
|
0
|
say STDERR $c; |
228
|
0
|
|
|
|
|
0
|
print STDERR qx($c); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
else # Compile and run |
231
|
0
|
0
|
|
|
|
0
|
{my $class = $package ? "$package.$name" : $name; # Class location |
232
|
0
|
|
|
|
|
0
|
my $p = join ' ', @ARGV; # Collect the remaining parameters and pass them to the java application |
233
|
0
|
|
|
|
|
0
|
my $c = "javac -g -d $cp -cp $cp $file && java -ea -cp $cp $class $p"; # Run java |
234
|
0
|
|
|
|
|
0
|
say STDERR $c; |
235
|
0
|
|
|
|
|
0
|
print STDERR qx($c); |
236
|
|
|
|
|
|
|
} |
237
|
0
|
|
|
|
|
0
|
&removeClasses; |
238
|
0
|
|
|
|
|
0
|
exit; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.(txt|htm)\Z)) # Html |
242
|
0
|
|
|
|
|
0
|
{my $s = expandWellKnownUrlsInHtmlFormat |
243
|
|
|
|
|
|
|
expandWellKnownWordsAsUrlsInHtmlFormat |
244
|
|
|
|
|
|
|
readFile $file; |
245
|
0
|
|
|
|
|
0
|
my $o = setFileExtension $file, q(html); # Output file |
246
|
0
|
|
|
|
|
0
|
my $f = owf $o, $s; |
247
|
|
|
|
|
|
|
|
248
|
0
|
0
|
|
|
|
0
|
if ($htmlToPdf) # Convert html to pdf if requested |
249
|
0
|
|
|
|
|
0
|
{my $p = setFileExtension($file, q(pdf)); |
250
|
0
|
|
|
|
|
0
|
say STDERR qx(wkhtmltopdf $f $p); |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
else # Show html in opera |
253
|
0
|
|
|
|
|
0
|
{my $c = qq(timeout 3m opera $o); |
254
|
0
|
|
|
|
|
0
|
say STDERR qq($c); |
255
|
0
|
|
|
|
|
0
|
say STDERR qx($c); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.py\Z)) # Python |
260
|
0
|
0
|
|
|
|
0
|
{if ($compile) # Syntax check |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
261
|
0
|
|
|
|
|
0
|
{print STDERR qx(python3 -m py_compile "$file"); |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
elsif ($run) # Run |
264
|
0
|
|
|
|
|
0
|
{print STDERR qx(python3 "$file"); |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
elsif ($doc) # Document |
267
|
0
|
|
|
|
|
0
|
{say STDERR "Document perl $file"; |
268
|
0
|
|
|
|
|
0
|
updatePerlModuleDocumentation($file); |
269
|
|
|
|
|
|
|
} |
270
|
0
|
|
|
|
|
0
|
exit; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
0
|
0
|
|
|
|
0
|
if ($file =~ m(\.(vala)\Z)) # Vala |
274
|
0
|
|
|
|
|
0
|
{my $lib = "--pkg gtk+-3.0"; # Libraries |
275
|
0
|
0
|
|
|
|
0
|
if ($compile) # Syntax check |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
276
|
0
|
|
|
|
|
0
|
{print STDERR qx(valac -c "$file" $lib); |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
elsif ($run) # Run |
279
|
0
|
|
|
|
|
0
|
{print STDERR qx(vala "$file" $lib); |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
elsif ($doc) # Document |
282
|
0
|
|
|
|
|
0
|
{say STDERR "Document perl $file"; |
283
|
0
|
|
|
|
|
0
|
updatePerlModuleDocumentation($file); |
284
|
|
|
|
|
|
|
} |
285
|
0
|
|
|
|
|
0
|
exit; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub removeClasses |
289
|
0
|
|
|
1
|
0
|
0
|
{unlink for fileList("*.class") |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub getPackageNameFromFile($) # Get package name from java file |
293
|
0
|
|
|
1
|
0
|
0
|
{my ($file) = @_; # File to read |
294
|
0
|
|
|
|
|
0
|
my $s = readFile($file); |
295
|
0
|
|
|
|
|
0
|
my ($p) = $s =~ m/package\s+(\S+)\s*;/; |
296
|
0
|
|
|
|
|
0
|
$p |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub cgiPerl($) # Run perl on web server |
300
|
0
|
|
|
1
|
0
|
0
|
{my ($file) = @_; # File to read |
301
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
0
|
my $r = qx(perl -CSDA -cw "$file" 2>&1); |
303
|
0
|
0
|
|
|
|
0
|
if ($r !~ m(syntax OK)) |
304
|
0
|
|
|
|
|
0
|
{say STDERR $r; |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
else |
307
|
0
|
|
|
|
|
0
|
{my $base = fne $file; |
308
|
0
|
|
|
|
|
0
|
my $target = fpf(q(/usr/lib/cgi-bin), $base); |
309
|
0
|
|
|
|
|
0
|
lll qx(echo 121212 | sudo -S cp $file $target); |
310
|
0
|
|
|
|
|
0
|
lll qx(echo 121212 | sudo chmod ugo+rx $target); |
311
|
0
|
|
|
|
|
0
|
lll qx(opera http://localhost/cgi-bin/$base &); |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
#d |
317
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
318
|
|
|
|
|
|
|
# Export - eeee |
319
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
use Exporter qw(import); |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
326
|
|
|
|
|
|
|
@EXPORT = qw(); |
327
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
328
|
|
|
|
|
|
|
); |
329
|
|
|
|
|
|
|
%EXPORT_TAGS = (all=>[@EXPORT, @EXPORT_OK]); |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# podDocumentation |
332
|
|
|
|
|
|
|
=pod |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=encoding utf-8 |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head1 Name |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
MakeWithPerl - Make with Perl |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=head1 Synopsis |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
Integrated development environment for Geany or similar editor for compiling |
343
|
|
|
|
|
|
|
running and documenting programs written in a number of languages. |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head2 Installation: |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
sudo cpan install MakeWithPerl |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head2 Operation |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Configure Geany as described at |
352
|
|
|
|
|
|
|
L. |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=head1 Description |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Make with Perl |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
Version "20210533". |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
The following sections describe the methods in each functional area of this |
363
|
|
|
|
|
|
|
module. For an alphabetic listing of all methods by name see L. |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=head1 Index |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=head1 Installation |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
This module is written in 100% Pure Perl and, thus, it is easy to read, |
374
|
|
|
|
|
|
|
comprehend, use, modify and install via B: |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sudo cpan install MakeWithPerl |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=head1 Author |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
L |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
L |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head1 Copyright |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Copyright (c) 2016-2021 Philip R Brenan. |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
This module is free software. It may be used, redistributed and/or modified |
389
|
|
|
|
|
|
|
under the same terms as Perl itself. |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=cut |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
# Tests and documentation |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
sub test |
398
|
0
|
|
|
1
|
0
|
0
|
{my $p = __PACKAGE__; |
399
|
0
|
|
|
|
|
0
|
binmode($_, ":utf8") for *STDOUT, *STDERR; |
400
|
0
|
50
|
|
|
|
0
|
return if eval "eof(${p}::DATA)"; |
401
|
0
|
|
|
|
|
0
|
my $s = eval "join('', <${p}::DATA>)"; |
402
|
0
|
50
|
|
|
|
0
|
$@ and die $@; |
403
|
0
|
|
|
|
|
0
|
eval $s; |
404
|
0
|
50
|
|
|
|
0
|
$@ and die $@; |
405
|
0
|
|
|
|
|
0
|
1 |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
test unless caller; |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
1; |
411
|
|
|
|
|
|
|
# podDocumentation |
412
|
|
|
|
|
|
|
__DATA__ |