{
    "content": [
        {
            "type": "text",
            "text": "# Locale::Maketext::Extract::Plugin::Base (perldoc)\n\n## NAME\n\nLocale::Maketext::Extract::Plugin::Base - Base module for format parser plugins\n\n## SYNOPSIS\n\npackage My::Parser::Plugin;\nuse base qw(Locale::Maketext::Extract::Plugin::Base);\nsub filetypes {\nreturn [qw( ext ext2 )]\n}\nsub extract {\nmy $self = shift;\nlocal $ = shift;\nmy $line = 1;\nwhile (my $found = $self->routinetoextractstrings) {\n$self->addentry($str,[$filename,$line,$vars])\n}\nreturn;\n}\n\n## DESCRIPTION\n\nAll format parser plugins in Locale::Maketext::Extract inherit from\nLocale::Maketext::Extract::Plugin::Base.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (5 subsections)\n- **SEE ALSO**\n- **AUTHORS**\n- **COPYRIGHT**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Locale::Maketext::Extract::Plugin::Base",
        "section": "",
        "mode": "perldoc",
        "summary": "Locale::Maketext::Extract::Plugin::Base - Base module for format parser plugins",
        "synopsis": "package My::Parser::Plugin;\nuse base qw(Locale::Maketext::Extract::Plugin::Base);\nsub filetypes {\nreturn [qw( ext ext2 )]\n}\nsub extract {\nmy $self = shift;\nlocal $ = shift;\nmy $line = 1;\nwhile (my $found = $self->routinetoextractstrings) {\n$self->addentry($str,[$filename,$line,$vars])\n}\nreturn;\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "new",
                        "lines": 4
                    },
                    {
                        "name": "add_entry",
                        "lines": 10
                    },
                    {
                        "name": "file_types",
                        "lines": 20
                    },
                    {
                        "name": "extract",
                        "lines": 20
                    },
                    {
                        "name": "known_file_type",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Locale::Maketext::Extract::Plugin::Base - Base module for format parser plugins\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 1.00\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package My::Parser::Plugin;\nuse base qw(Locale::Maketext::Extract::Plugin::Base);\n\nsub filetypes {\nreturn [qw( ext ext2 )]\n}\n\nsub extract {\nmy $self = shift;\nlocal $ = shift;\n\nmy $line = 1;\n\nwhile (my $found = $self->routinetoextractstrings) {\n$self->addentry($str,[$filename,$line,$vars])\n}\n\nreturn;\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "All format parser plugins in Locale::Maketext::Extract inherit from\nLocale::Maketext::Extract::Plugin::Base.\n\nIf you want to write your own custom parser plugin, you will need to inherit from this module,\nand provide \"filetypes()\" and \"extract()\" methods, as shown above.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "new",
                        "content": "$plugin = My::Parser->new(\n@filetypes         # Optionally specify a list of recognised file types\n)\n"
                    },
                    {
                        "name": "add_entry",
                        "content": "$plugin->addentry($str,$line,$vars)\n\n\"entries()\"\n$entries = $plugin->entries;\n\n\"clear()\"\n$plugin->clear\n\nClears all stored entries.\n"
                    },
                    {
                        "name": "file_types",
                        "content": "@defaultfiletypes = $plugin->filetypes\n\nReturns a list of recognised file types that your module knows how to parse.\n\nEach file type can be one of:\n\n*   A plain string\n\n'pl'  => base filename is matched against qr/\\.pl$/\n'*'   => all files are accepted\n\n*   A regex\n\nqr/\\.tt2?\\./ => base filename is matched against this regex\n\n*   A codref\n\nsub {}  => this codref is called as $coderef->($basefilename,$pathtofile)\nIt should return true or false\n"
                    },
                    {
                        "name": "extract",
                        "content": "$plugin->extract($filecontents);\n\nextract() is the method that will be called to process the contents of the current file.\n\nWhen it finds a string that should be extracted, it should call\n\n$self->addentry($string,$line,$vars])\n\nwhere $vars refers to any arguments that are being passed to the localise function. For\ninstance:\n\nl(\"You found [quant,1,file,files]\",filesfound)\n\nstring: \"You found [quant,1,file,files]\"\nvars  : (filesfound)\n\nIMPORTANT: a single plugin instance is used for all files, so if you plan on storing state\ninformation in the $plugin object, this should be cleared out at the beginning of\n\"extract()\"\n"
                    },
                    {
                        "name": "known_file_type",
                        "content": "if ($plugin->knownfiletype($filenamewithpath)) {\n....\n}\n\nDetermines whether the current file should be handled by this parser, based either on the\nlist of filetypes specified when this object was created, or the default filetypes\nspecified in the module.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "xgettext.pl\nfor extracting translatable strings from common template systems and perl source files.\n\nLocale::Maketext::Lexicon\nLocale::Maketext::Extract::Plugin::Perl\nLocale::Maketext::Extract::Plugin::PPI\nLocale::Maketext::Extract::Plugin::TT2\nLocale::Maketext::Extract::Plugin::YAML\nLocale::Maketext::Extract::Plugin::FormFu\nLocale::Maketext::Extract::Plugin::Mason\nLocale::Maketext::Extract::Plugin::TextTemplate\nLocale::Maketext::Extract::Plugin::Generic\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   Clinton Gormley <drtech@cpan.org>\n\n*   Audrey Tang <cpan@audreyt.org>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2002-2013 by Audrey Tang <cpan@audreyt.org>.\n\nThis software is released under the MIT license cited below.\n\nThe \"MIT\" License\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software\nand associated documentation files (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or\nsubstantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING\nBUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is Copyright (c) 2014 by Audrey Tang.\n\nThis is free software, licensed under:\n\nThe MIT (X11) License\n",
                "subsections": []
            }
        }
    }
}