View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
XAO Inc. > XAO-Web-1.05a > XAO::DO::Web::Config



Annotate this POD


Open  0
View/Report Bugs
Module Version: 1.10   Source   Latest Release: XAO-Web-1.47


XAO::DO::Web::Config - XAO::Web site configuration object


 sub init {
     my $self=shift;

     my $webconfig=XAO::Objects->new(objname => 'Web::Config');

     $self->embed(web => $webconfig);


This object provides methods specifically for XAO::Web objects. It is supposed to be embedded into XAO::DO::Config object by a web server handler when site is initialized.


add_cookie (@)

Adds an HTTP cookie into the internal list. If there is only one parameter we assume it is already encoded cookie, otherwise we assume it is a hash of parameters for CGI->cookie method (see CGI).

If a cookie with that name is already in the list from a previous call to add_cookie() then it gets replaced. This check is only performed if you pass a hash of arguments, not already prepared cookie.

Think of it as if you are adding cookies to you final HTTP response as XAO::Web handler will get all the cookies collected during template processing and send them out for you.



 $config->add_cookie(-name => 'sessionID',
                     -value => 'xyzzy',
cgi (;$)

Returns or sets standard CGI object (see CGI). In future versions this would probably be converted to CGI::Lite or something similar, so do not rely to much on the functionality of CGI.

Obviously you should not call this method to set CGI object unless you are 100% sure you know what you're doing. And even in that case you have to call enable_special_access() in advance.


 my $cgi=$self->cgi;
 my $name=$cgi->param('name');

Or just:

 my $name=$self->cgi->param('name');
cleanup ()

Removes CGI object, cleans up clipboard. No need to call manually, usually is called as part of XAO::DO::Config cleanup().

clipboard ()

Returns clipboard XAO::SimpleHash object. Useful to keep temporary data between different XAO::Web objects. Cleaned up for every session.

cookies ()

Returns reference to an array of prepared cookies.

disable_special_access ()

Disables use of cgi() method to set a new value.

embeddable_methods ()

Used internally by global Config object, returns an array with all embeddable method names -- add_cookie(), cgi(), clipboard(), cookies(), header(), header_args().

enable_special_access ()

Enables use of cgi() method to set a new value. Normally you do not need this method.


header (@)

Returns HTTP header. The same as $cgi->header and accepts the same parameters. Cookies added before by add_cookie() method are also included in the header.

Returns header only once, on subsequent calls returns undef.

NOTE: In mod_perl environment CGI will send the header itself and return empty string. Be carefull to check the result for if(defined($header)) instead of just if($header)!

As with the most of Web::Config methods you do not need this method normally. It is called automatically by web server handler at the end of a session before sending out session results.

header_args (%)

Sets some parameters for header generation. You can use it to change page status for example:

 $config->header_args(-Status => '404 File not found');

Accepts the same arguments CGI->header() accepts.

new ($$)

Creates a new empty configuration object.


Copyright (c) 1999-2001 XAO Inc.

Author is Andrew Maltsev <>.


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

syntax highlighting: