{
    "content": [
        {
            "type": "text",
            "text": "# CGI::FormBuilder::Source (perldoc)\n\n## NAME\n\nCGI::FormBuilder::Source - Source adapters for FormBuilder\n\n## SYNOPSIS\n\n# Define a source adapter\npackage CGI::FormBuilder::Source::Whatever;\nsub new {\nmy $self  = shift;\nmy $class = ref($self) || $self;\nmy %opt   = @;\nreturn bless \\%opt, $class;\n}\nsub parse {\nmy $self = shift;\nmy $file = shift || $self->{source};\n# open the file and parse it, or whatever\nmy %formopt;\nopen(F, \"<$file\") || die \"Can't read $file: $!\";\nwhile (<F>) {\n# ... do stuff to the line ...\n$formopt{$fboption} = $fbvalue;\n}\n# return hash of $form options\nreturn wantarray ? %formopt : \\%formopt;\n}\n\n## DESCRIPTION\n\nThis documentation describes the usage of FormBuilder sources, as well as how to write your own\nsource adapter.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **SEE ALSO**\n- **REVISION**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CGI::FormBuilder::Source",
        "section": "",
        "mode": "perldoc",
        "summary": "CGI::FormBuilder::Source - Source adapters for FormBuilder",
        "synopsis": "# Define a source adapter\npackage CGI::FormBuilder::Source::Whatever;\nsub new {\nmy $self  = shift;\nmy $class = ref($self) || $self;\nmy %opt   = @;\nreturn bless \\%opt, $class;\n}\nsub parse {\nmy $self = shift;\nmy $file = shift || $self->{source};\n# open the file and parse it, or whatever\nmy %formopt;\nopen(F, \"<$file\") || die \"Can't read $file: $!\";\nwhile (<F>) {\n# ... do stuff to the line ...\n$formopt{$fboption} = $fbvalue;\n}\n# return hash of $form options\nreturn wantarray ? %formopt : \\%formopt;\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 39,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REVISION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CGI::FormBuilder::Source - Source adapters for FormBuilder\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "# Define a source adapter\n\npackage CGI::FormBuilder::Source::Whatever;\n\nsub new {\nmy $self  = shift;\nmy $class = ref($self) || $self;\nmy %opt   = @;\nreturn bless \\%opt, $class;\n}\n\nsub parse {\nmy $self = shift;\nmy $file = shift || $self->{source};\n\n# open the file and parse it, or whatever\nmy %formopt;\nopen(F, \"<$file\") || die \"Can't read $file: $!\";\nwhile (<F>) {\n# ... do stuff to the line ...\n$formopt{$fboption} = $fbvalue;\n}\n\n# return hash of $form options\nreturn wantarray ? %formopt : \\%formopt;\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This documentation describes the usage of FormBuilder sources, as well as how to write your own\nsource adapter.\n\nAn external source is invoked by using the \"source\" option to the top-level \"new()\" method:\n\nmy $form = CGI::FormBuilder->new(\nsource => 'sourcefile.conf'\n);\n\nThis example points to a filename that contains a file following the\n\"CGI::FormBuilder::Source::File\" layout. Like with the \"template\" option, you can also specify\n\"source\" as a reference to a hash, allowing you to use other source adapters:\n\nmy $form = CGI::FormBuilder->new(\nfields => \\@fields,\nsource => {\ntype => 'File',\nsource => '/path/to/source.conf',\n}\n);\n\nThe \"type\" option specifies the name of the source adapter. Currently accepted types are:\n\nFile  -  CGI::FormBuilder::Source::File\n\nIn addition to one of these types, you can also specify a complete package name, in which case\nthat module will be autoloaded and its \"new()\" and \"parse()\" routines used. For example:\n\nmy $form = CGI::FormBuilder->new(\nfields => \\@fields,\nsource => {\ntype => 'My::Source::Module',\nsomefile => '/path/to/source.conf',\n}\n);\n\nAll other options besides \"type\" are passed to the constructor for that source module verbatim,\nso it's up to you and/or the source module on how these additional options should be handled.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CGI::FormBuilder, CGI::FormBuilder::Source::File,\n",
                "subsections": []
            },
            "REVISION": {
                "content": "$Id: Source.pm 100 2007-03-02 18:13:13Z nwiger $\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Copyright (c) Nate Wiger <http://nateware.com>. All Rights Reserved.\n\nThis module is free software; you may copy this under the terms of the GNU General Public\nLicense, or the Artistic License, copies of which should have accompanied your Perl kit.\n",
                "subsections": []
            }
        }
    }
}