version 1.3, 2000/08/16 18:32:58
|
version 1.4, 2000/08/22 16:19:26
|
Line 8 use strict;
|
Line 8 use strict;
|
use Apache::lonnet; |
use Apache::lonnet; |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block')); |
&Apache::lonxml::register('Apache::structuretags',('block','while')); |
} |
} |
|
|
sub start_block { |
sub start_block { |
Line 30 sub start_block {
|
Line 30 sub start_block {
|
sub end_block { |
sub end_block { |
} |
} |
|
|
|
sub start_while { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
|
|
my $code = @$parstack[$#$parstack]; |
|
$code =~ s/\"//g; |
|
$code .=';return $condition;'; |
|
|
|
print "<H2>WHILE CONDITION = [$code]</H2>"; |
|
my $result = &Apache::run::run($code,$safeeval); |
|
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
|
if ( $result ) { # condition is TRUE, bodytext is evaluated |
|
# push the bodytext into parser stack |
|
my $tempparser=HTML::TokeParser->new(\$bodytext); |
|
push (@$parser,$tempparser); |
|
} else { # condition is FALSE initially, skip bodytext |
|
} |
|
return ""; |
|
} |
|
|
|
sub end_while { |
|
# pop parser from parser stack |
|
# check if condition is TRUE, |
|
# TRUE then push content into parser stack |
|
# FALSE then continue |
|
|
|
} |
|
|
1; |
1; |
__END__ |
__END__ |