Skip to content

Commit 3e920b8

Browse files
author
Chris White
committed
Began work on pre/postprocessors [minor]
Also, this branch will eventually add a Run() method so you can get a string result for use in the caller's program without having to use capture().
1 parent d6ca649 commit 3e920b8

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

lib/Text/PerlPP.pm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,17 +667,24 @@ sub Include { # As ProcessFile(), but for use within :macro
667667
$self->StartOB(); # re-open a plain-text OB
668668
} #Include
669669

670-
sub OutputResult {
670+
sub FinalizeResult {
671671
my $self = shift;
672672
my $contents_ref = shift; # reference
673-
my $fname = shift; # "" or other false value => STDOUT
674-
my $proc;
675-
my $out_fh;
676673

677-
for $proc ( @{$self->{Postprocessors}} ) {
674+
for my $proc ( @{$self->{Postprocessors}} ) {
678675
&$proc( $contents_ref );
679676
}
677+
return $contents_ref;
678+
} #FinalizeResult()
680679

680+
sub OutputResult {
681+
my $self = shift;
682+
my $contents_ref = shift; # reference
683+
my $fname = shift; # "" or other false value => STDOUT
684+
685+
$self->FinalizeResult( $contents_ref );
686+
687+
my $out_fh;
681688
if ( $fname ) {
682689
open( $out_fh, ">", $fname ) or die $!;
683690
} else {

t/09-preproc.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!perl
2+
3+
# TODO test preprocessors
4+
exit 1;

t/10-postproc.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!perl
2+
3+
# TODO test postprocessors
4+
exit 1;

0 commit comments

Comments
 (0)