Andrew Maltsev > XAO-Web > XAO::DO::Web::Condition

Download:
XAO-Web-1.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 2.001   Source  

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

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) 2005 Andrew Maltsev

Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.

<am@ejelta.com> -- http://ejelta.com/xao/

SEE ALSO ^

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

syntax highlighting: