{
    "content": [
        {
            "type": "text",
            "text": "# Template::Plugin::Datafile (perldoc)\n\n## NAME\n\nTemplate::Plugin::Datafile - Plugin to construct records from a simple data file\n\n## SYNOPSIS\n\n[% USE mydata = datafile('/path/to/datafile') %]\n[% USE mydata = datafile('/path/to/datafile', delim = '|') %]\n[% FOREACH record = mydata %]\n[% record.this %]  [% record.that %]\n[% END %]\n\n## DESCRIPTION\n\nThis plugin provides a simple facility to construct a list of hash references, each of which\nrepresents a data record of known structure, from a data file.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **BUGS**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Template::Plugin::Datafile",
        "section": "",
        "mode": "perldoc",
        "summary": "Template::Plugin::Datafile - Plugin to construct records from a simple data file",
        "synopsis": "[% USE mydata = datafile('/path/to/datafile') %]\n[% USE mydata = datafile('/path/to/datafile', delim = '|') %]\n[% FOREACH record = mydata %]\n[% record.this %]  [% record.that %]\n[% END %]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Template::Plugin::Datafile - Plugin to construct records from a simple data file\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "[% USE mydata = datafile('/path/to/datafile') %]\n[% USE mydata = datafile('/path/to/datafile', delim = '|') %]\n\n[% FOREACH record = mydata %]\n[% record.this %]  [% record.that %]\n[% END %]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This plugin provides a simple facility to construct a list of hash references, each of which\nrepresents a data record of known structure, from a data file.\n\n[% USE datafile(filename) %]\n\nA absolute filename must be specified (for this initial implementation at least - in a future\nversion it might also use the \"INCLUDEPATH\"). An optional \"delim\" parameter may also be\nprovided to specify an alternate delimiter character.\n\n[% USE userlist = datafile('/path/to/file/users')     %]\n[% USE things   = datafile('items', delim = '|') %]\n\nThe format of the file is intentionally simple. The first line defines the field names,\ndelimited by colons with optional surrounding whitespace. Subsequent lines then defines records\ncontaining data items, also delimited by colons. e.g.\n\nid : name : email : tel\nabw : Andy Wardley : abw@tt2.org : 555-1234\nsam : Simon Matthews : sam@tt2.org : 555-9876\n\nEach line is read, split into composite fields, and then used to initialise a hash array\ncontaining the field names as relevant keys. The plugin returns a blessed list reference\ncontaining the hash references in the order as defined in the file.\n\n[% FOREACH user = userlist %]\n[% user.id %]: [% user.name %]\n[% END %]\n\nThe first line of the file must contain the field definitions. After the first line, blank lines\nwill be ignored, along with comment line which start with a '\"#\"'.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Should handle file names relative to \"INCLUDEPATH\". Doesn't permit use of '\":\"' in a field.\nSome escaping mechanism is required.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Andy Wardley <abw@wardley.org> <http://wardley.org/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Template::Plugin\n",
                "subsections": []
            }
        }
    }
}