From 336a77d326c13e3bda2d522ec77ef043fc438fbb Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 9 Nov 2018 21:59:52 -0500 Subject: [PATCH] Remove $C and @F (old test variables) [minor] And a bit of other cleanup --- MANIFEST | 1 - README.md | 8 ++++---- lib/XML/Axk/Core.pm | 34 +++++++++++++--------------------- lib/XML/Axk/L/L1.pm | 2 +- t/ex/1.axk | 9 --------- t/ex/2.axk | 8 -------- t/tests/L1.pm | 2 +- 7 files changed, 19 insertions(+), 45 deletions(-) delete mode 100644 t/ex/2.axk diff --git a/MANIFEST b/MANIFEST index 0c4387a..5a20eaf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -32,7 +32,6 @@ t/06-class-tests.t t/ex/02-noL.axk t/ex/02.axk t/ex/1.axk -t/ex/2.axk t/ex/ex1.xml t/ex/lTEST.axk t/ex/nutrition.xml diff --git a/README.md b/README.md index 902e21e..ad3f6d9 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ To install this module, run the following commands: - perl Makefile.PL - make - make test - make install + perl Makefile.PL + make + make test + make install ## USAGE diff --git a/lib/XML/Axk/Core.pm b/lib/XML/Axk/Core.pm index c8d851d..fda88ee 100644 --- a/lib/XML/Axk/Core.pm +++ b/lib/XML/Axk/Core.pm @@ -105,7 +105,6 @@ Load the given text, but do not execute it. Usage: =cut -# TODO permit specifying a specific Ln? # @param $self # @param $text {String} The source text, **which load_script_text may modify.** # @param $filename {String} Filename to use in debugging messages @@ -127,14 +126,13 @@ sub load_script_text { # Text to wrap around the script my ($leader, $trailer) = ('', ''); - #say "Text is $text"; my $hrInitialPragmas = {}; - $hrInitialPragmas = { L => {$curr_lang ? (name => '' . $curr_lang) : ()} } - if $add_Ln || $curr_lang; + if($add_Ln || $curr_lang) { + $hrInitialPragmas = { L => {$curr_lang ? (name => '' . $curr_lang) : ()} }; + } my ($lrPieces, $has_lang) = XML::Axk::Preparse::pieces(\$text, $hrInitialPragmas); - #say "Has lang" if $has_lang; unless($has_lang || $curr_lang) { if($add_Ln) { $lrPieces->[0]->{pragmas}->{L}->{digits} = 1; # default language @@ -143,7 +141,6 @@ sub load_script_text { } } - #say Dumper($lrPieces); my $srNewText = XML::Axk::Preparse::assemble($fn, $lrPieces); $text = $$srNewText; @@ -252,10 +249,15 @@ sub run_sax_fh { } #run_sax_fh() -# Run the loaded script(s). Takes a list of inputs. Strings are treated -# as filenames; references to strings are treated as raw data to be run -# as if read off disk. A filename of '-' represents STDIN. To process a -# disk file named '-', read its contents first and pass them in as a ref. +=head2 run + +Run the loaded script or scripts. Takes a list of inputs. Strings are treated +as filenames; references to strings are treated as raw data to be run +as if read off disk. A filename of '-' represents STDIN. To process a +disk file named '-', read its contents first and pass them in as a ref. + +=cut + sub run { my $self = shift; @@ -270,11 +272,7 @@ sub run { my $fh; #say "Processing $infn"; - # Clear the SPs before each file for consistency. - # TODO remove $C and @F from the codebase and samples. They are - # leftovers from before the split of the languages into Ln modules. - $self->{sp}->{'$C'} = undef; - @{$self->{sp}->{'@F'}} = (); + # TODO? Clear the SPs before each file for consistency? # For now, just process lines rather than XML nodes. if($infn eq '-') { # stdin @@ -388,12 +386,6 @@ sub global_name { =pod -=head2 load_script_file - -=head2 load_script_text - -=head2 run - =head1 AUTHOR Christopher White, C diff --git a/lib/XML/Axk/L/L1.pm b/lib/XML/Axk/L/L1.pm index 4ab1d7c..20c5611 100755 --- a/lib/XML/Axk/L/L1.pm +++ b/lib/XML/Axk/L/L1.pm @@ -184,7 +184,7 @@ sub sel { # Script parameters ============================================== {{{1 # Script-parameter names -our @SP_names = qw($C @F $D $E $NOW); +our @SP_names = qw($D $E $NOW); sub update { #say "L1::update: ", Dumper(\@_); diff --git a/t/ex/1.axk b/t/ex/1.axk index cd2c484..b30466e 100644 --- a/t/ex/1.axk +++ b/t/ex/1.axk @@ -11,17 +11,8 @@ post_all { say "post_all"; }; my $x=42; -perform { - #say join ' ', 'within perform $C',\$C,'@F',\@F; - chomp $C; - say "Line is=> $C"; - say join '; ', @F; - $C = 'Modified $C ' . ++$x; -} 'line!'; - perform { say "Always"; - push @F, "from ex1"; } always; perform { diff --git a/t/ex/2.axk b/t/ex/2.axk deleted file mode 100644 index 6a001f8..0000000 --- a/t/ex/2.axk +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env axk -L1 -perform { - my $x = $C; - chomp $x; - say __FILE__, " sees line $x"; - say __FILE__, ' ', join '; ', @F; -} qr/.?/; - diff --git a/t/tests/L1.pm b/t/tests/L1.pm index 4f319e9..e6ceff0 100644 --- a/t/tests/L1.pm +++ b/t/tests/L1.pm @@ -7,7 +7,7 @@ use AxkTest; use parent 'Test::Class'; use Test::Exception; -sub class { "XML::Axk::L1" }; +sub class { "XML::Axk::L::L1" }; diag("Testing ", class);