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