@@ -105,7 +105,6 @@ Load the given text, but do not execute it. Usage:
105
105
106
106
=cut
107
107
108
- # TODO permit specifying a specific Ln?
109
108
# @param $self
110
109
# @param $text {String} The source text, **which load_script_text may modify.**
111
110
# @param $filename {String} Filename to use in debugging messages
@@ -127,14 +126,13 @@ sub load_script_text {
127
126
# Text to wrap around the script
128
127
my ($leader , $trailer ) = (' ' , ' ' );
129
128
130
- # say "Text is $text";
131
129
my $hrInitialPragmas = {};
132
- $hrInitialPragmas = { L => {$curr_lang ? (name => ' ' . $curr_lang ) : ()} }
133
- if $add_Ln || $curr_lang ;
130
+ if ($add_Ln || $curr_lang ) {
131
+ $hrInitialPragmas = { L => {$curr_lang ? (name => ' ' . $curr_lang ) : ()} };
132
+ }
134
133
135
134
my ($lrPieces , $has_lang ) = XML::Axk::Preparse::pieces(\$text , $hrInitialPragmas );
136
135
137
- # say "Has lang" if $has_lang;
138
136
unless ($has_lang || $curr_lang ) {
139
137
if ($add_Ln ) {
140
138
$lrPieces -> [0]-> {pragmas }-> {L }-> {digits } = 1; # default language
@@ -143,7 +141,6 @@ sub load_script_text {
143
141
}
144
142
}
145
143
146
- # say Dumper($lrPieces);
147
144
my $srNewText = XML::Axk::Preparse::assemble($fn , $lrPieces );
148
145
$text = $$srNewText ;
149
146
@@ -252,10 +249,15 @@ sub run_sax_fh {
252
249
253
250
} # run_sax_fh()
254
251
255
- # Run the loaded script(s). Takes a list of inputs. Strings are treated
256
- # as filenames; references to strings are treated as raw data to be run
257
- # as if read off disk. A filename of '-' represents STDIN. To process a
258
- # disk file named '-', read its contents first and pass them in as a ref.
252
+ =head2 run
253
+
254
+ Run the loaded script or scripts. Takes a list of inputs. Strings are treated
255
+ as filenames; references to strings are treated as raw data to be run
256
+ as if read off disk. A filename of '-' represents STDIN. To process a
257
+ disk file named '-', read its contents first and pass them in as a ref.
258
+
259
+ =cut
260
+
259
261
sub run {
260
262
my $self = shift ;
261
263
@@ -270,11 +272,7 @@ sub run {
270
272
my $fh ;
271
273
# say "Processing $infn";
272
274
273
- # Clear the SPs before each file for consistency.
274
- # TODO remove $C and @F from the codebase and samples. They are
275
- # leftovers from before the split of the languages into Ln modules.
276
- $self -> {sp }-> {' $C' } = undef ;
277
- @{$self -> {sp }-> {' @F' }} = ();
275
+ # TODO? Clear the SPs before each file for consistency?
278
276
279
277
# For now, just process lines rather than XML nodes.
280
278
if ($infn eq ' -' ) { # stdin
@@ -388,12 +386,6 @@ sub global_name {
388
386
389
387
=pod
390
388
391
- =head2 load_script_file
392
-
393
- =head2 load_script_text
394
-
395
- =head2 run
396
-
397
389
=head1 AUTHOR
398
390
399
391
Christopher White, C<cxwembedded at gmail.com >
0 commit comments