File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -292,31 +292,33 @@ sub OnOpening {
292
292
sub OnClosing {
293
293
my $inside ;
294
294
my $insetMode ;
295
- my $plainMode = OBMODE_PLAIN;
295
+ my $nextMode = OBMODE_PLAIN;
296
296
297
297
$insetMode = GetModeOfOB();
298
298
$inside = EndOB(); # contents of the inset
299
299
if ( $inside =~ / "$ / ) {
300
300
StartOB( $insetMode ); # restore contents of the inset
301
301
print substr ( $inside , 0, -1 );
302
- $plainMode = OBMODE_CAPTURE;
302
+ $nextMode = OBMODE_CAPTURE;
303
303
} else {
304
304
if ( $insetMode == OBMODE_ECHO ) {
305
305
print " print ${inside} ;\n " ; # don't wrap in (), trailing semicolon
306
306
} elsif ( $insetMode == OBMODE_COMMAND ) {
307
307
ExecuteCommand( $inside );
308
308
} elsif ( $insetMode == OBMODE_COMMENT ) {
309
309
# Ignore the contents - no operation
310
+ } elsif ( $insetMode == OBMODE_CODE ) {
311
+ print " $inside \n " ; # \n so you can put comments in your perl code
310
312
} else {
311
313
print $inside ;
312
314
}
313
315
314
316
if ( GetModeOfOB() == OBMODE_CAPTURE ) { # if the inset is wrapped
315
317
print EndOB() . " PerlPP::EndOB(); } . " ; # end of do { .... } statement
316
- $plainMode = OBMODE_CAPTURE; # back to capturing
318
+ $nextMode = OBMODE_CAPTURE; # back to capturing
317
319
}
318
320
}
319
- StartOB( $plainMode ); # plain text
321
+ StartOB( $nextMode ); # plain text
320
322
} # OnClosing()
321
323
322
324
sub RunPerlPP {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ my @testcases=(
16
16
[' Foo <?= 2+2 ?> <? print "?>Howdy, "world!" I\' m cool.<?"; ?> bar' ." \n " ,
17
17
' Foo 4 Howdy, "world!" I\' m cool. bar' ." \n " ],
18
18
[' <?# This output file is tremendously boring. ?>' ,' ' ],
19
+ [' <? my $x=42; #this is a comment?><?=$x?>' ,' 42' ],
19
20
[' <?#ditto?>' ,' ' ],
20
21
[' <? my $foo=80; ?>#define QUUX (<?= $foo/40 ?>)' , ' #define QUUX (2)' ],
21
22
[' <? print (map { $_ . $_ . "\n" } qw(a b c d)); ?>' ," aa\n bb\n cc\n dd\n " ],
You can’t perform that action at this time.
0 commit comments