NAME

Apache2::ASP::GlobalConfig - Config manager for Apache2::ASP web applications

SYNOPSIS

my $global = Apache2::ASP::GlobalConfig->new();

# Find config based on $ENV{HTTP_HOST} or `domain`:
my $current = $global->find_current_config();

# Find config for a specific domain:
my $domain_config = $global->domain_config( 'whatever.com' );

# Get a list of all web application configs:
my @configs = $global->web_applications;

DESCRIPTION

Apache2::ASP::GlobalConfig attempts to keep all of your web applications' configuration data in one place:

Your /conf/apache2-asp-config.xml file.

It should look like this:

<?xml version="1.0" ?>
<config>
  <web_application>
    <domain_re>.*</domain_re>
    <do_reload_on_script_change>1</do_reload_on_script_change>
    <application_name>DefaultApp</application_name>
    <application_root>@ServerRoot@</application_root>
    <handler_root>@ServerRoot@/handlers</handler_root>
    <media_manager_upload_root>@ServerRoot@/MEDIA</media_manager_upload_root>
    <www_root>@ServerRoot@/htdocs</www_root>
    <page_cache_root>@ServerRoot@/PAGE_CACHE</page_cache_root>
    <application_state>
      <manager>Apache2::ASP::ApplicationStateManager::MySQL</manager>
      <dsn>DBI:mysql:dstack_dev:localhost</dsn>
      <password>j@p@n</password>
      <username>root</username>
    </application_state>
    <session_state>
      <manager>Apache2::ASP::SessionStateManager::SQLite</manager>
      <cookie_domain>apache2-asp.no-ip.org</cookie_domain>
      <cookie_name>session-id</cookie_name>
      <dsn>DBI:mysql:dstack_dev:localhost</dsn>
      <password>j@p@n</password>
      <username>root</username>
      <session_timeout>30</session_timeout>
    </session_state>
    <settings>
      <lib>@ServerRoot/lib</lib>
      <dsn>DBI:mysql:dbname:hostname</dsn>
      <username>my-username</username>
      <password>swordfish</password>
    </settings>
    <request_filters>
      <filter>
        <uri_match>/members_only/.*</uri_match>
        <class>My::MemberFilter</class>
      </filter>
    </request_filters>
  </web_application>
</config>

If it doesn't look like that, an exception will be thrown.

Those little @ServerRoot@ tags are replaced with the value of $ENV{APACHE2_ASP_APPLICATION_ROOT} when the XML file is loaded up and parsed.

For more information about setting up the config file and where it goes, please read Apache2::ASP::Manual::ConfigXML.

METHODS

find_current_config( )

Returns the current Apache2::ASP::Config object in use. This is determined by calling domain_config and passing in either $ENV{HTTP_HOST} or the value returned by Sys::Hostname::hostname(). See Sys::Hostname for details on how it works.

domain_config( $hostname )

Returns the Apache2::ASP::Config object whose <domain_re> matches $hostname.

web_applications( )

Returns a list of Apache2::ASP::Config objects - one per <web_application> element in the XML config file.

BUGS

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.

HOMEPAGE

Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.

AUTHOR

John Drago mailto:jdrago_999@yahoo.com

COPYRIGHT AND LICENSE

Copyright 2007 John Drago, All rights reserved.

This software is free software. It may be used and distributed under the same terms as Perl itself.