<commit_before>package TestAPI::internal_redirect;

use strict;
use warnings FATAL => 'all';

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::SubRequest ();

use Apache::Const -compile => 'OK';

sub modperl {
    my $r = shift;

    my %args = map { split('=', $_, 2) } split /[&]/, $r->args;
    if ($args{main}) {
        # sub-req
        $r->content_type('text/plain');
        $r->print("internal redirect: $args{main} => modperl");
    }
    else {
        # main-req
        my $redirect_uri = $args{uri};
        $r->internal_redirect("$redirect_uri?main=modperl");
    }

    Apache::OK;
}

sub perl_script {
    my $r = shift;

    my %args = map { split('=', $_, 2) } split /[&]/, $r->args;
    if ($args{main}) {
        # sub-req
        $r->content_type('text/plain');
        print "internal redirect: $args{main} => perl-script";
    }
    else {
        # main-req
        my $redirect_uri = $args{uri};
        $r->internal_redirect("$redirect_uri?main=perl-script");
    }<commit_msg>embed debugging <commit_after>package TestAPI::internal_redirect;

use strict;
use warnings FATAL => 'all';

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::SubRequest ();

use Apache::TestTrace;

use Apache::Const -compile => 'OK';

sub modperl {
    my $r = shift;

    my %args = map { split('=', $_, 2) } split /[&]/, $r->args;
    if ($args{main}) {
        # sub-req
        $r->content_type('text/plain');
        debug "modperl: sub-req: response";
        $r->print("internal redirect: $args{main} => modperl");
    }
    else {
        # main-req
        my $redirect_uri = $args{uri};
        debug "modperl: main-req => $redirect_uri?main=modperl";
        $r->internal_redirect("$redirect_uri?main=modperl");
    }

    Apache::OK;
}

sub perl_script {
    my $r = shift;

    my %args = map { split('=', $_, 2) } split /[&]/, $r->args;
    if ($args{main}) {
        # sub-req
        $r->content_type('text/plain');
        debug "perl-script: sub-req: response";
        print "internal redirect: $args{main} => perl-script";
    }
    else {
        # main-req
        my $redirect_uri = $args{uri};
        debug "perl-script: main-req => $redirect_uri?main=perl-script";
        $r->internal_redirect("$redirect_uri?main=perl-script");
    }
{'fraction_non_alphanumeric': 0.18545929473225947, 'fraction_numerical': 0.0017414018284719198, 'mean_word_length': 2.6534181240063592, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4138935', 'n_tokens_mistral': 804, 'n_tokens_neox': 777, 'n_words': 164}