NAME

XAO::DO::Web::Condition - allows to check various conditions

SYNOPSIS

Only useful in XAO::Web context.

DESCRIPTION

Example usage would be:

<%Condition NAME1.value="<%CgiParam param=test%>"
            NAME1.path="/bits/test-is-set"
            NAME2.cgiparam="foo"
            NAME2.path="/bits/foo-is-set"
            NAME3.siteconfig="product_list"
            NAME3.template="product_list exists in siteconfig"
            default.objname="Error"
            default.template="No required parameter set"
%>

Which means to execute /bits/test-is-set if CGI has `test' parameter, otherwise execute /bits/foo-is-set if `foo' parameter is set and finally, if there is no foo and no test - execute /bits/nothing-set. For `foo' shortcut is used, because most of the time you will check for CGI parameters anyway.

Default object to be substituted is Page. Another object may be specified with objname. All arguments after NAMEx. are just passed into object without any processing.

NAME1 and NAME2 may be anything, they sorted alphabetycally before checking. So, usually if there is only one check and default - then something meaningful is used for the name. For multiple choices just numbers are better for names.

Condition checked in perl style - '0' and empty string is false.

Hides itself from object it executes - makes parent and parent_args pointing to Condition's parent.

Supports the following conditions:

value

Just constant value, usually substituted in template itself.

cgiparam

Parameter in CGI.

arg

Parent object argument.

siteconf

Site configuration parameter.

Cookie value.

secure

True if the the current page is being transferred over a secure connection (the url prefix is https://). Value is not used.

All values are treated as booleans only, no comparision is implemented yet.

METHODS

No publicly available methods except overriden display().

EXPORTS

Nothing.

AUTHOR

Copyright (c) 2000-2001 XAO, Inc.

Andrew Maltsev <am@xao.com>.

SEE ALSO

Recommended reading: XAO::Web, XAO::DO::Web::Page.