Lemplate
view release on metacpan or search on metacpan
$label ||= 'LOOP';
return <<EOF;
do {
my \$_tt_failsafe = $WHILE_MAX;
$label:
while (--\$_tt_failsafe && ($expr)) {
$block
}
die "WHILE loop terminated (> $WHILE_MAX iterations)\\n"
unless \$_tt_failsafe;
};
EOF
}
sub switch {
my ($self, $expr, $case) = @_;
my @case = @$case;
do
local failsafe = $WHILE_MAX;
while $expr do
failsafe = failsafe - 1
if failsafe <= 0 then
break
end
$block
end
if not failsafe then
return error("WHILE loop terminated (> $WHILE_MAX iterations)\\n")
end
end
EOF
}
sub javascript {
my ( $class, $javascript ) = @_;
return $javascript;
}
lib/Lemplate/Directive.pm view on Meta::CPAN
do
local failsafe = $WHILE_MAX;
while $expr do
failsafe = failsafe - 1
if failsafe <= 0 then
break
end
$block
end
if not failsafe then
return error("WHILE loop terminated (> $WHILE_MAX iterations)\\n")
end
end
EOF
}
#------------------------------------------------------------------------
# javascript($script) [% JAVASCRIPT %]
# ...
# [% END %]
#------------------------------------------------------------------------
( run in 1.839 second using v1.01-cache-2.11-cpan-71847e10f99 )