{
    "mode": "perldoc",
    "parameter": "CGI::Application::Standard::Config",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/CGI%3A%3AApplication%3A%3AStandard%3A%3AConfig/json",
    "generated": "2026-06-09T17:35:00Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "CGI::Application::Standard::Config -- Define a standard configuration API for CGI::Application\n",
            "subsections": []
        },
        "RATIONALE": {
            "content": "This module defines a minimum standard interface that configuration plugins for CGI::Application\nshould meet. Having such a standard allows other plugin authors to rely on basic configuration\nfunctionality without coding exceptions for several configuration modules, or giving up on such\nintegration.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "For Average Users",
                    "content": "Simply load the config plugin before other modules that might use it:\n\nuse CGI::Application::Plugin::ConfigAuto;\nuse CGI::Application::Plugin::Session;\n"
                },
                {
                    "name": "For Configuration plugin authors",
                    "content": "Configuration plugin authors only need to follow the standards documented below.\n"
                },
                {
                    "name": "For other plugin authors who wish to rely on the standard",
                    "content": "Plugin authors who want to possibly use this standard can do so by simply using this module:\n\npackage CGI::Application::Plugin::Session;\nuse CGI::Application::Standard::Config;\n\nIf a standards complaint config module hasn't already been loaded a stub for config() will be\nadded which will safely return \"undef\".\n\nExample use by another plugin\nHere code first tries to get configuration details first from a config file, then from options\npassed to a plugin-specific config method, and finally applies defaults if no configuration\noptions are found.\n\nmy $sessionoptions = $self->config('Sessionoptions')\n|| $self->sessionconfig()\n|| $self->sessiondefaults;\n"
                }
            ]
        },
        "Standard Interface Definition": {
            "content": "The following defines a minimum standard for configuration plugins to meet.\n\nConfig plugins are free to provide to additional functionality.\n\nConfiguration plugins are also encourage to explicitly document that they are using\n\"CGI::Application::Standard::Config\".\n\nIf there are existing methods that follow the standard but have different names, you can use\nthis example to always export your method:\n\nsub import {\nmy $app = caller;\nno strict 'refs';\nmy $fullname = $app . '::config';\n# Change cfg to your config()-compliant method name\n*$fullname = \\&cfg;\nCGI::Application::Plugin::YourNameHere->exporttolevel(1,@);\n}\n\n$self->stdconfig\nThis method should be exported by default to simply declare that you meet the standard report\nwhich version of the standard you meet. This simple implementation is recommended:\n\nsub stdconfig { return 1; }\n\n$self->config\nThe intended use is to load to read-only configuration details once from a config file at start\nup time.\n\nThis service is provided by plugins (list below). They must support at at least this syntax:\n\nmy $value = $self->config('key');\n\nBy default, \"config()\" simply returns undef, making it safe for other plugins to directly to\ncheck if \"$self-\"config('key')> returns the value it needs.\n",
            "subsections": [
                {
                    "name": "config",
                    "content": "For applications that need little configuration, config() is not necessary-- using \"PARAMS\" in\nan instance script should suffice.\n\nAlso, the \"param()\" is the appropriate method to use to set a configuration value at run time.\n\nConfiguration plugins that provide at least this basic API include:\n\nCGI::Application::Plugin::ConfigAuto.\n\nStandard config variables\nUsers are encouraged to use these standard config variable names, to ease compatibility between\nplugins:\n\nROOTURI - A URI corresponding to the project root (http://foo.com/proj )\nROOTDIR - a file system path to the same location ( /home/joe/www/proj )\n\nAll-caps are used to denote that config variables are essentially global constants.\n\nWhy URI and not URL? The wikipedia explains:\n\nThe contemporary point of view among the working group that oversees URIs is\nthat the terms URL and URN are context-dependent aspects of URI and rarely\nneed to be distinguished. Furthermore, the term URL is increasingly becoming\nobsolete, as it is rarely necessary to differentiate between URLs and URIs,\nin general.\n"
                }
            ]
        },
        "Standard Version": {
            "content": "This is 1.0 of the CGI::Application config() standard.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Written by Mark Stosberg <mark@summersault.com> with input from the CGI::Application community.\n\nCOPYRIGHT and LICENSE\nCopyright (C) 2008, Mark Stosberg. All rights reserved.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "CGI::Application::Standard::Config -- Define a standard configuration API for CGI::Application",
    "flags": [],
    "examples": [],
    "see_also": []
}