<commit_before>#!/usr/bin/env perl
# JSX compiler wrapper working on POSIX compatible environment

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

package App::jsx;
{

    use File::Basename ();
    use constant DIR => File::Basename::dirname(readlink(__FILE__) || __FILE__);
    use lib DIR . "/../extlib/lib/perl5";

    # required modules
    use Cwd         ();
    use Carp        ();
    use IO::Socket  ();
    use HTTP::Tiny  ();

    #use Time::HiRes      (); # lazy
    #use POSIX            (); # lazy
    #use File::Path       (); # lazy
    #use Text::ParseWords (); # lazy
    #use File::Temp       (); # lazy


    BEGIN {
        if (eval { require JSON::XS }) {
            *encode_json = \&JSON::XS::encode_json;
            *decode_json = \&JSON::XS::decode_json;
        }
        else {
            require JSON;
            *encode_json = \&JSON::encode_json;
            *decode_json = \&JSON::decode_json;
        }
    }

    my $jsx_compiler = DIR . "/../bin/jsx-compiler.js";

    my $home = $ENV{JSX_HOME} || (($ENV{HOME} || glob('~')) . "/.jsx");

    my $pid_file  = "$home/pid";<commit_msg>fix failure on `npm install -g jsx`<commit_after>#!/usr/bin/env perl
# JSX compiler wrapper working on POSIX compatible environment

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

package App::jsx;
{

    use File::Basename ();
    use File::Spec     ();

    my $DIR;
    BEGIN {
        my $linkTo = readlink(__FILE__);
        my $FILE;
        if ($linkTo) {
            if (File::Spec->file_name_is_absolute($linkTo)) {
                $FILE = $linkTo;
            }
            else {
                $FILE = File::Spec->catfile(File::Basename::dirname(__FILE__), $linkTo);
            }
        }
        else {
            $FILE = __FILE__;
        }

        $DIR = File::Basename::dirname($FILE);
        require lib;
        lib->import("$DIR/../extlib/lib/perl5");
    }

    # required modules
    use Cwd         ();
    use Carp        ();
    use IO::Socket  ();
    use HTTP::Tiny  ();

    #use Time::HiRes      (); # lazy
    #use POSIX            (); # lazy
    #use File::Path       (); # lazy
    #use Text::ParseWords (); # lazy
    #use File::Temp       (); # lazy


    BEGIN {
        if (eval { require JSON::XS }) {
            *encode_json = \&JSON::XS::encode_json;
            *decode_json = \&JSON::XS::decode_json;
        }
        else {
            require JSON;
            *encode_json = \&JSON::encode_json;
            *decode_json = \&JSON::decode_json;
        }
    }

    my $jsx_compiler = "$DIR/../bin/jsx-compiler.js";

    my $home = $ENV{JSX_HOME} || (($ENV{HOME} || glob('~')) . "/.jsx");

    my $pid_file  = "$home/pid";
{'fraction_non_alphanumeric': 0.163003663003663, 'fraction_numerical': 0.0007326007326007326, 'mean_word_length': 1.8477580813347236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5341070', 'n_tokens_mistral': 908, 'n_tokens_neox': 867, 'n_words': 193}