Skip to content

Commit

Permalink
Remove $C and @f (old test variables) [minor]
Browse files Browse the repository at this point in the history
And a bit of other cleanup
  • Loading branch information
Chris White committed Nov 10, 2018
1 parent a08718b commit 336a77d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 45 deletions.
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
34 changes: 13 additions & 21 deletions lib/XML/Axk/Core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -143,7 +141,6 @@ sub load_script_text {
}
}

#say Dumper($lrPieces);
my $srNewText = XML::Axk::Preparse::assemble($fn, $lrPieces);
$text = $$srNewText;

Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -388,12 +386,6 @@ sub global_name {

=pod
=head2 load_script_file
=head2 load_script_text
=head2 run
=head1 AUTHOR
Christopher White, C<cxwembedded at gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion lib/XML/Axk/L/L1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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(\@_);
Expand Down
9 changes: 0 additions & 9 deletions t/ex/1.axk
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 0 additions & 8 deletions t/ex/2.axk

This file was deleted.

2 changes: 1 addition & 1 deletion t/tests/L1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 336a77d

Please sign in to comment.