HTML

Conditional HTML

Conditional HTML

This page will show a table when the calculated random numer is odd. Here is what we calculated : dummy text which has a modulus of dummy text
yohoho
andabottle
ofrum,son
let'shavefun!
Perl package index; srand (time ^ $$ ); sub new { my $that = shift; my $class = ref( $that ) || $that; my $this = { class_map => { calc_random => \&calc_random, show_random => \&show_random, show_tab => \&show_tab, }, # other stuff you want here ... }; return bless $this, $class; } sub calc_random { my( $this, $node, $class, $is_end_tag ) = @_; return 0 if $is_end_tag; $this->{random} = sprintf '%d', rand(1000); return 1; } sub show_random { my( $this, $node, $class, $is_end_tag ) = @_; return 0 if $is_end_tag; $this->{display} = ($this->{random} % 2); ($node->children())[0]->text( $this->{random}); return 1; } 1;