Compiler-Parser

 view release on metacpan or  search on metacpan

t/app/Plack/HTTPParser.t  view on Meta::CPAN

            args => reg_prefix { 'qw',
                expr => leaf 'Exporter',
            },
        },
        branch { '=',
            left => leaf '@EXPORT',
            right => reg_prefix { 'qw',
                expr => leaf ' parse_http_request ',
            },
        },
        module { 'Try::Tiny',
        },
        block { '',
            body => if_stmt { 'if',
                expr => branch { '&&',
                    left => single_term_operator { '!',
                        expr => hash { '$ENV',
                            key => hash_ref { '{}',
                                data => leaf 'PLACK_HTTP_PARSER_PP',
                            },
                        },

t/app/Plack/HTTPParser.t  view on Meta::CPAN


done_testing;

__DATA__
package Plack::HTTPParser;
use strict;
use parent qw(Exporter);

our @EXPORT = qw( parse_http_request );

use Try::Tiny;

{
    if (!$ENV{PLACK_HTTP_PARSER_PP} && try { require HTTP::Parser::XS; 1 }) {
        *parse_http_request = \&HTTP::Parser::XS::parse_http_request;
    } else {
        require Plack::HTTPParser::PP;
        *parse_http_request = \&Plack::HTTPParser::PP::parse_http_request;
    }
}

t/app/Plack/Handler/Apache2/Registry.t  view on Meta::CPAN

    my $tokens = Compiler::Lexer->new('')->tokenize($script);
    my $ast = Compiler::Parser->new->parse($tokens);
    Compiler::Parser::AST::Renderer->new->render($ast);
    node_ok($ast->root, [
        Test::Compiler::Parser::package { 'Plack::Handler::Apache2::Registry',
        },
        module { 'strict',
        },
        module { 'warnings',
        },
        module { 'Try::Tiny',
        },
        module { 'Apache2::Const',
        },
        module { 'Apache2::Log',
        },
        module { 'parent',
            args => reg_prefix { 'qw',
                expr => leaf 'Plack::Handler::Apache2',
            },
        },

t/app/Plack/Handler/Apache2/Registry.t  view on Meta::CPAN

        leaf '1',
    ]);
};

done_testing;

__DATA__
package Plack::Handler::Apache2::Registry;
use strict;
use warnings;
use Try::Tiny;
use Apache2::Const;
use Apache2::Log;
use parent qw/Plack::Handler::Apache2/;

sub handler {
    my $class = __PACKAGE__;
    my ($r) = @_;

    return try {
        my $app = $class->load_app( $r->filename );

t/app/Plack/Loader.t  view on Meta::CPAN

        Test::Compiler::Parser::package { 'Plack::Loader',
        },
        module { 'strict',
        },
        module { 'Carp',
            args => list { '()',
            },
        },
        module { 'Plack::Util',
        },
        module { 'Try::Tiny',
        },
        function { 'new',
            body => [
                branch { '=',
                    left => leaf '$class',
                    right => function_call { 'shift',
                        args => [
                        ],
                    },
                },

t/app/Plack/Loader.t  view on Meta::CPAN

    ]);
};

done_testing;

__DATA__
package Plack::Loader;
use strict;
use Carp ();
use Plack::Util;
use Try::Tiny;

sub new {
    my $class = shift;
    bless {}, $class;
}

sub watch {
    # do nothing. Override in subclass
}

t/app/Plack/Loader/Restarter.t  view on Meta::CPAN

        },
        module { 'warnings',
        },
        module { 'parent',
            args => reg_prefix { 'qw',
                expr => leaf 'Plack::Loader',
            },
        },
        module { 'Plack::Util',
        },
        module { 'Try::Tiny',
        },
        function { 'new',
            body => [
                branch { '=',
                    left => list { '()',
                        data => branch { ',',
                            left => leaf '$class',
                            right => leaf '$runner',
                        },
                    },

t/app/Plack/Loader/Restarter.t  view on Meta::CPAN

};

done_testing;

__DATA__
package Plack::Loader::Restarter;
use strict;
use warnings;
use parent qw(Plack::Loader);
use Plack::Util;
use Try::Tiny;

sub new {
    my($class, $runner) = @_;
    bless { watch => [] }, $class;
}

sub preload_app {
    my($self, $builder) = @_;
    $self->{builder} = $builder;
}

t/app/Plack/Loader/Shotgun.t  view on Meta::CPAN

        },
        module { 'strict',
        },
        module { 'parent',
            args => reg_prefix { 'qw',
                expr => leaf 'Plack::Loader',
            },
        },
        module { 'Storable',
        },
        module { 'Try::Tiny',
        },
        module { 'Plack::Middleware::BufferedStreaming',
        },
        function { 'preload_app',
            body => [
                branch { '=',
                    left => list { '()',
                        data => branch { ',',
                            left => leaf '$self',
                            right => leaf '$builder',

t/app/Plack/Loader/Shotgun.t  view on Meta::CPAN

    ]);
};

done_testing;

__DATA__
package Plack::Loader::Shotgun;
use strict;
use parent qw(Plack::Loader);
use Storable;
use Try::Tiny;
use Plack::Middleware::BufferedStreaming;

sub preload_app {
    my($self, $builder) = @_;
    $self->{builder} = sub { Plack::Middleware::BufferedStreaming->wrap($builder->()) };
}

sub run {
    my($self, $server) = @_;

t/app/Plack/Runner.t  view on Meta::CPAN

        module { 'strict',
        },
        module { 'warnings',
        },
        module { 'Carp',
            args => list { '()',
            },
        },
        module { 'Plack::Util',
        },
        module { 'Try::Tiny',
        },
        function { 'new',
            body => [
                branch { '=',
                    left => leaf '$class',
                    right => function_call { 'shift',
                        args => [
                        ],
                    },
                },

t/app/Plack/Runner.t  view on Meta::CPAN

};

done_testing;

__DATA__
package Plack::Runner;
use strict;
use warnings;
use Carp ();
use Plack::Util;
use Try::Tiny;

sub new {
    my $class = shift;
    bless {
        env      => $ENV{PLACK_ENV},
        loader   => 'Plack::Loader',
        includes => [],
        modules  => [],
        default_middleware => 1,
        @_,

t/app/Plack/Test/MockHTTP.t  view on Meta::CPAN

        module { 'warnings',
        },
        module { 'Carp',
        },
        module { 'HTTP::Request',
        },
        module { 'HTTP::Response',
        },
        module { 'HTTP::Message::PSGI',
        },
        module { 'Try::Tiny',
        },
        function { 'test_psgi',
            body => [
                branch { '=',
                    left => leaf '%args',
                    right => leaf '@_',
                },
                branch { 'or',
                    left => branch { '=',
                        left => leaf '$client',

t/app/Plack/Test/MockHTTP.t  view on Meta::CPAN


__DATA__
package Plack::Test::MockHTTP;
use strict;
use warnings;

use Carp;
use HTTP::Request;
use HTTP::Response;
use HTTP::Message::PSGI;
use Try::Tiny;

sub test_psgi {
    my %args = @_;

    my $client = delete $args{client} or croak "client test code needed";
    my $app    = delete $args{app}    or croak "app needed";

    my $cb = sub {
        my $req = shift;
        $req->uri->scheme('http')    unless defined $req->uri->scheme;

t/app/Plack/Test/Suite.t  view on Meta::CPAN

        module { 'Test::TCP',
        },
        module { 'Plack::Loader',
        },
        module { 'Plack::Middleware::Lint',
        },
        module { 'Plack::Util',
        },
        module { 'Plack::Request',
        },
        module { 'Try::Tiny',
        },
        branch { '=',
            left => leaf '$share_dir',
            right => function_call { 'try',
                args => [
                    branch { '||',
                        left => hash_ref { '{}',
                            data => function_call { 'File::ShareDir::dist_dir',
                                args => [
                                    leaf 'Plack',

t/app/Plack/Test/Suite.t  view on Meta::CPAN

use File::ShareDir;
use HTTP::Request;
use HTTP::Request::Common;
use LWP::UserAgent;
use Test::More;
use Test::TCP;
use Plack::Loader;
use Plack::Middleware::Lint;
use Plack::Util;
use Plack::Request;
use Try::Tiny;

my $share_dir = try { File::ShareDir::dist_dir('Plack') } || 'share';

$ENV{PLACK_TEST_SCRIPT_NAME} = '';

# 0: test name
# 1: request generator coderef.
# 2: request handler
# 3: test case for response
our @TEST = (



( run in 0.536 second using v1.01-cache-2.11-cpan-05444aca049 )