NAME

XML::Template::Element::Condition - XML::Template plugin module for the condition namespace tagset.

SYNOPSIS

This XML::Template plugin module implements the condition namespace tagset. The condition namespace includes tags for creating flow control structures.

CONSTRUCTOR

XML::Template::Element::Block inherits its constructor method, new, from XML::Template::Element.

CONDITION TAGSET METHODS

if

This method implements the beginning of an if flow control structure. The following attributes are used:

cond

The test to perform that, if evaluates to true, passes control to the content of the if element.

elseif

This method implements the elseif section of an if flow control structure. The following attributes are used:

cond

The test to perform that, if evaluates to true, passes control to the content of the elseif element.

else

This method implements the else section of an if flow control structure.

switch

This method implements the beginning of a switch flow control structure. The following attributes are used:

expr

The expression to compare to the value attribute of each nested case element. When a match is found, the content of that case element is evaluated.

case

This method implements the case section of a switch flow control structure. The following attributes are used:

value

If this value match the switch expression, the content of this case element will be evaluated.

    sub case { my $self = shift; my ($code, $attribs) = @_;

    my $value = $self->get_attrib ($attribs, 'value');

    # my $cond; # if ($value =~ /^\/.*\/$/) { # $cond = "\$expr =~ $value"; # } else { my $cond = "\$__expr eq '$value'"; # }

    my $outcode = qq!
      $cond && do {
        $code
        last SWITCH;
      };
    !;
    
    return $outcode;
    }

default

This method implements the default section of a switch control structure. The content is evaluates when no case values match the switch expression.

AUTHOR

Jonathan Waxman <jowaxman@bbl.med.upenn.edu>

COPYRIGHT

Copyright (c) 2002-2003 Jonathan A. Waxman All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 202:

You forgot a '=back' before '=head2'

You forgot a '=back' before '=head2'