{
    "content": [
        {
            "type": "text",
            "text": "# TAP::Parser::SourceHandler::Perl (perldoc)\n\n**Summary:** TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable\n\n**Synopsis:** use TAP::Parser::Source;\nuse TAP::Parser::SourceHandler::Perl;\nmy $source = TAP::Parser::Source->new->raw( \\'script.pl' );\n$source->assemblemeta;\nmy $class = 'TAP::Parser::SourceHandler::Perl';\nmy $vote  = $class->canhandle( $source );\nmy $iter  = $class->makeiterator( $source );\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **VERSION** (2 lines)\n- **SYNOPSIS** (10 lines)\n- **DESCRIPTION** (9 lines)\n- **METHODS** (1 lines) — 1 subsections\n  - Class Methods (50 lines)\n- **SUBCLASSING** (2 lines) — 1 subsections\n  - Example (18 lines)\n- **SEE ALSO** (4 lines)\n\n## Full Content\n\n### NAME\n\nTAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable\n\n### VERSION\n\nVersion 3.43\n\n### SYNOPSIS\n\nuse TAP::Parser::Source;\nuse TAP::Parser::SourceHandler::Perl;\n\nmy $source = TAP::Parser::Source->new->raw( \\'script.pl' );\n$source->assemblemeta;\n\nmy $class = 'TAP::Parser::SourceHandler::Perl';\nmy $vote  = $class->canhandle( $source );\nmy $iter  = $class->makeiterator( $source );\n\n### DESCRIPTION\n\nThis is a *Perl* TAP::Parser::SourceHandler - it has 2 jobs:\n\n1. Figure out if the TAP::Parser::Source it's given is actually a Perl script (\"canhandle\").\n\n2. Creates an iterator for Perl sources (\"makeiterator\").\n\nUnless you're writing a plugin or subclassing TAP::Parser, you probably won't need to use this\nmodule directly.\n\n### METHODS\n\n#### Class Methods\n\n\"canhandle\"\nmy $vote = $class->canhandle( $source );\n\nOnly votes if $source looks like a file. Casts the following votes:\n\n0.9  if it has a shebang ala \"#!...perl\"\n0.75 if it has any shebang\n0.8  if it's a .t file\n0.9  if it's a .pl file\n0.75 if it's in a 't' directory\n0.25 by default (backwards compat)\n\n\"makeiterator\"\nmy $iterator = $class->makeiterator( $source );\n\nConstructs & returns a new TAP::Parser::Iterator::Process for the source. Assumes \"$source->raw\"\ncontains a reference to the perl script. \"croak\"s if the file could not be found.\n\nThe command to run is built as follows:\n\n$perl @switches $perlscript @testargs\n\nThe perl command to use is determined by \"getperl\". The command generated is guaranteed to\npreserve:\n\nPERL5LIB\nPERL5OPT\nTaint Mode, if set in the script's shebang\n\n*Note:* the command generated will *not* respect any shebang line defined in your Perl script.\nThis is only a problem if you have compiled a custom version of Perl or if you want to use a\nspecific version of Perl for one test and a different version for another, for example:\n\n#!/path/to/a/customperl --some --args\n#!/usr/local/perl-5.6/bin/perl -w\n\nCurrently you need to write a plugin to get around this.\n\n\"gettaint\"\nDecode any taint switches from a Perl shebang line.\n\n# $taint will be 't'\nmy $taint = TAP::Parser::SourceHandler::Perl->gettaint( '#!/usr/bin/perl -t' );\n\n# $untaint will be undefined\nmy $untaint = TAP::Parser::SourceHandler::Perl->gettaint( '#!/usr/bin/perl' );\n\n\"getperl\"\nGets the version of Perl currently running the test suite.\n\n### SUBCLASSING\n\nPlease see \"SUBCLASSING\" in TAP::Parser for a subclassing overview.\n\n#### Example\n\npackage MyPerlSourceHandler;\n\nuse strict;\n\nuse TAP::Parser::SourceHandler::Perl;\n\nuse base 'TAP::Parser::SourceHandler::Perl';\n\n# use the version of perl from the shebang line in the test file\nsub getperl {\nmy $self = shift;\nif (my $shebang = $self->shebang( $self->{file} )) {\n$shebang =~ /^#!(.*\\bperl.*?)(?:(?:\\s)|(?:$))/;\nreturn $1 if $1;\n}\nreturn $self->SUPER::getperl(@);\n}\n\n### SEE ALSO\n\nTAP::Object, TAP::Parser, TAP::Parser::IteratorFactory, TAP::Parser::SourceHandler,\nTAP::Parser::SourceHandler::Executable, TAP::Parser::SourceHandler::File,\nTAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::RawTAP\n\n"
        }
    ],
    "structuredContent": {
        "command": "TAP::Parser::SourceHandler::Perl",
        "section": "",
        "mode": "perldoc",
        "summary": "TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable",
        "synopsis": "use TAP::Parser::Source;\nuse TAP::Parser::SourceHandler::Perl;\nmy $source = TAP::Parser::Source->new->raw( \\'script.pl' );\n$source->assemblemeta;\nmy $class = 'TAP::Parser::SourceHandler::Perl';\nmy $vote  = $class->canhandle( $source );\nmy $iter  = $class->makeiterator( $source );",
        "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": 10,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Class Methods",
                        "lines": 50
                    }
                ]
            },
            {
                "name": "SUBCLASSING",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Example",
                        "lines": 18
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable\n",
                "subsections": []
            },
            "VERSION": {
                "content": "Version 3.43\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use TAP::Parser::Source;\nuse TAP::Parser::SourceHandler::Perl;\n\nmy $source = TAP::Parser::Source->new->raw( \\'script.pl' );\n$source->assemblemeta;\n\nmy $class = 'TAP::Parser::SourceHandler::Perl';\nmy $vote  = $class->canhandle( $source );\nmy $iter  = $class->makeiterator( $source );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a *Perl* TAP::Parser::SourceHandler - it has 2 jobs:\n\n1. Figure out if the TAP::Parser::Source it's given is actually a Perl script (\"canhandle\").\n\n2. Creates an iterator for Perl sources (\"makeiterator\").\n\nUnless you're writing a plugin or subclassing TAP::Parser, you probably won't need to use this\nmodule directly.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Class Methods",
                        "content": "\"canhandle\"\nmy $vote = $class->canhandle( $source );\n\nOnly votes if $source looks like a file. Casts the following votes:\n\n0.9  if it has a shebang ala \"#!...perl\"\n0.75 if it has any shebang\n0.8  if it's a .t file\n0.9  if it's a .pl file\n0.75 if it's in a 't' directory\n0.25 by default (backwards compat)\n\n\"makeiterator\"\nmy $iterator = $class->makeiterator( $source );\n\nConstructs & returns a new TAP::Parser::Iterator::Process for the source. Assumes \"$source->raw\"\ncontains a reference to the perl script. \"croak\"s if the file could not be found.\n\nThe command to run is built as follows:\n\n$perl @switches $perlscript @testargs\n\nThe perl command to use is determined by \"getperl\". The command generated is guaranteed to\npreserve:\n\nPERL5LIB\nPERL5OPT\nTaint Mode, if set in the script's shebang\n\n*Note:* the command generated will *not* respect any shebang line defined in your Perl script.\nThis is only a problem if you have compiled a custom version of Perl or if you want to use a\nspecific version of Perl for one test and a different version for another, for example:\n\n#!/path/to/a/customperl --some --args\n#!/usr/local/perl-5.6/bin/perl -w\n\nCurrently you need to write a plugin to get around this.\n\n\"gettaint\"\nDecode any taint switches from a Perl shebang line.\n\n# $taint will be 't'\nmy $taint = TAP::Parser::SourceHandler::Perl->gettaint( '#!/usr/bin/perl -t' );\n\n# $untaint will be undefined\nmy $untaint = TAP::Parser::SourceHandler::Perl->gettaint( '#!/usr/bin/perl' );\n\n\"getperl\"\nGets the version of Perl currently running the test suite.\n"
                    }
                ]
            },
            "SUBCLASSING": {
                "content": "Please see \"SUBCLASSING\" in TAP::Parser for a subclassing overview.\n",
                "subsections": [
                    {
                        "name": "Example",
                        "content": "package MyPerlSourceHandler;\n\nuse strict;\n\nuse TAP::Parser::SourceHandler::Perl;\n\nuse base 'TAP::Parser::SourceHandler::Perl';\n\n# use the version of perl from the shebang line in the test file\nsub getperl {\nmy $self = shift;\nif (my $shebang = $self->shebang( $self->{file} )) {\n$shebang =~ /^#!(.*\\bperl.*?)(?:(?:\\s)|(?:$))/;\nreturn $1 if $1;\n}\nreturn $self->SUPER::getperl(@);\n}\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "TAP::Object, TAP::Parser, TAP::Parser::IteratorFactory, TAP::Parser::SourceHandler,\nTAP::Parser::SourceHandler::Executable, TAP::Parser::SourceHandler::File,\nTAP::Parser::SourceHandler::Handle, TAP::Parser::SourceHandler::RawTAP\n",
                "subsections": []
            }
        }
    }
}