Avoid direct accessing of variables inside the module

This commit is contained in:
acli 2004-02-16 23:50:56 +00:00
parent 0b6030aecd
commit 2f7192689a
2 changed files with 9 additions and 2 deletions

View file

@ -265,6 +265,13 @@ sub next_token (*) {
############################################################################### ###############################################################################
# Other easy functions
sub blank_p ($) {
my($s) = @_;
return $s =~ /^(?:\s|\&nbsp$re_end_entity|$re_tmpl_var)*$/os;
}
sub trim ($) { sub trim ($) {
my($s) = @_; my($s) = @_;
$s =~ s/^(?:\s|\&nbsp$re_end_entity)+//os; $s =~ s/^(?:\s|\&nbsp$re_end_entity)+//os;

View file

@ -27,7 +27,7 @@ use vars qw( $pedantic_p );
sub debug_dump (*) { # for testing only sub debug_dump (*) { # for testing only
my($h) = @_; my($h) = @_;
print "re_tag_compat is /$TmplTokenizer::re_tag_compat/\n"; print "re_tag_compat is /", TmplTokenizer::re_tag(1), "/\n";
for (;;) { for (;;) {
my $s = TmplTokenizer::next_token $h; my $s = TmplTokenizer::next_token $h;
last unless defined $s; last unless defined $s;
@ -79,7 +79,7 @@ sub text_extract (*) {
# Don't emit pure whitespace, pure numbers, or TMPL_VAR's. # Don't emit pure whitespace, pure numbers, or TMPL_VAR's.
for my $t (keys %text) { for my $t (keys %text) {
printf "%s\n", $t printf "%s\n", $t
unless $t =~ /^(?:\s|\&nbsp$TmplTokenizer::re_end_entity|$TmplTokenizer::re_tmpl_var)*$/os || $t =~ /^\d+$/; unless TmplTokenizer::blank_p($t) || $t =~ /^\d+$/;
} }
} }