We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 510bfe2 commit cf369d4Copy full SHA for cf369d4
perlpp.pl
@@ -434,13 +434,20 @@ sub Main {
434
StartOB();
435
print "package PPP_${Package};\nuse strict;\nuse warnings;\n";
436
437
- # TODO transfer parameters from the command line to the processed file.
+ # Transfer parameters from the command line (-s) to the processed file.
438
# Per commit 7bbe05c, %DEF is for those parameters.
439
- print "my %DEF = ();\n";
+ print "my %DEF = (\n";
440
+ for my $defname (keys %{$opts{DEFS}}) {
441
+ print " $defname => ", ${$opts{DEFS}}{$defname}, "\n";
442
+ }
443
+ print ");\n";
444
445
+ # Initial code from the command line, if any
446
print $opts{EVAL}, "\n" if $opts{EVAL};
447
448
+ # The input file
449
ProcessFile( $opts{INPUT_FILENAME} );
450
+
451
my $script = EndOB(); # The generated Perl script
452
453
if ( $opts{DEBUG} ) {
t/cmdline.t
@@ -2,7 +2,7 @@
2
# Tests of perlpp command-line options
3
use strict;
4
use warnings;
5
-use Test::More;
+use Test::More 'no_plan';
6
use IPC::Run3;
7
use constant CMD => 'perl perlpp.pl';
8
@@ -18,9 +18,15 @@ my @testcases=(
18
['--eval \'my $foo=42;\'','<?= $foo ?>', qr/^42$/],
19
['-d -e \'my $foo=42;\'','<?= $foo ?>', qr/^my \$foo=42;/m],
20
['--debug --eval \'my $foo=42;\'','<?= $foo ?>', qr/^print\s+\$foo\s*;/m],
21
+ ['-s foo=1', '<?= $DEF{foo} ?>',qr/^1$/],
22
+ ['-s foo=\"blah\"', '<?= $DEF{foo} ?>',qr/^blah$/],
23
+ # Have to escape the double-quotes so perl sees it as a string
24
+ # literal instead of a bareword.
25
); #@testcases
26
-plan tests => scalar @testcases;
27
+#plan tests => scalar @testcases;
28
+# TODO count the out_re and err_re in @testcases, since the number of
29
+# tests is the sum of those counts.
30
31
for my $lrTest (@testcases) {
32
my ($opts, $testin, $out_re, $err_re) = @$lrTest;
0 commit comments