<commit_before>package Mojolicious::Plugin::Config;
use Mojo::Base 'Mojolicious::Plugin';

use File::Basename 'basename';
use File::Spec::Functions 'file_name_is_absolute';
use Mojo::Util 'decamelize';

# "Who are you, my warranty?!"
sub load {
  my ($self, $file, $conf, $app) = @_;
  $app->log->debug(qq{Reading config file "$file".});

  # Slurp UTF-8 file
  open my $handle, "<:encoding(UTF-8)", $file
    or die qq{Couldn't open config file "$file": $!};
  my $content = do { local $/; <$handle> };

  # Process
  return $self->parse($content, $file, $conf, $app);
}

sub parse {
  my ($self, $content, $file, $conf, $app) = @_;

  # Run Perl code
  my $config = eval 'package Mojolicious::Plugin::Config::Sandbox;'
    . "no warnings; sub app { \$app }; use Mojo::Base -strict; $content";
  die qq{Couldn't load configuration from file "$file": $@} if !$config && $@;
  die qq{Config file "$file" did not return a hash reference.\n}
    unless ref $config eq 'HASH';

  return $config;
}

sub register {
  my ($self, $app, $conf) = @_;

  # Config file
  my $file = $conf->{file} || $ENV{MOJO_CONFIG};
  unless ($file) {

    # File or class
    $file
      = $ENV{MOJO_EXE} ? basename($ENV{MOJO_EXE}) : decamelize($ENV{MOJO_APP});

    # Replace ".pl" and ".t" with default extention
    $file =~ s/\.(?:pl|t)$//i;<commit_msg>fixed typo in comment<commit_after>package Mojolicious::Plugin::Config;
use Mojo::Base 'Mojolicious::Plugin';

use File::Basename 'basename';
use File::Spec::Functions 'file_name_is_absolute';
use Mojo::Util 'decamelize';

# "Who are you, my warranty?!"
sub load {
  my ($self, $file, $conf, $app) = @_;
  $app->log->debug(qq{Reading config file "$file".});

  # Slurp UTF-8 file
  open my $handle, "<:encoding(UTF-8)", $file
    or die qq{Couldn't open config file "$file": $!};
  my $content = do { local $/; <$handle> };

  # Process
  return $self->parse($content, $file, $conf, $app);
}

sub parse {
  my ($self, $content, $file, $conf, $app) = @_;

  # Run Perl code
  my $config = eval 'package Mojolicious::Plugin::Config::Sandbox;'
    . "no warnings; sub app { \$app }; use Mojo::Base -strict; $content";
  die qq{Couldn't load configuration from file "$file": $@} if !$config && $@;
  die qq{Config file "$file" did not return a hash reference.\n}
    unless ref $config eq 'HASH';

  return $config;
}

sub register {
  my ($self, $app, $conf) = @_;

  # Config file
  my $file = $conf->{file} || $ENV{MOJO_CONFIG};
  unless ($file) {

    # File or class
    $file
      = $ENV{MOJO_EXE} ? basename($ENV{MOJO_EXE}) : decamelize($ENV{MOJO_APP});

    # Replace ".pl" and ".t" with default extension
    $file =~ s/\.(?:pl|t)$//i;
{'fraction_non_alphanumeric': 0.19147344801795063, 'fraction_numerical': 0.0014958863126402393, 'mean_word_length': 3.8813868613138687, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 13, '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': '5607099', 'n_tokens_mistral': 1008, 'n_tokens_neox': 968, 'n_words': 276}