<commit_before>###############################################################################
#
# config.pm
#
# Configuration values
#
###############################################################################

package plsearch::config;

use strict;
use warnings;

use parent 'Exporter';

our $HOME = $ENV{HOME};
if ($^O eq 'MSWin32') {
	$HOME = $ENV{USERPROFILE};
}

our $XSEARCHPATH = "$HOME/src/xsearch";
our $SHAREDPATH = "$XSEARCHPATH/shared";
our $FILETYPESPATH = "$SHAREDPATH/filetypes.xml";
our $SEARCHOPTIONSPATH = "$SHAREDPATH/searchoptions.xml";

our @EXPORT = qw($HOME $XSEARCHPATH $SHAREDPATH $FILETYPESPATH $SEARCHOPTIONSPATH);

1;

__END__<commit_msg>Load shared config.json in perl<commit_after>###############################################################################
#
# config.pm
#
# Configuration values
#
###############################################################################

package plsearch::config;

use strict;
use warnings;

use parent 'Exporter';

use Cwd qw(abs_path);
use File::Basename;
use File::Spec;
use JSON::PP;

use plsearch::FileUtil;

my $absdir = dirname(abs_path(__FILE__));
my $config_json_path = File::Spec->join($absdir, '../../shared/config.json');
my $config = decode_json plsearch::FileUtil::get_file_contents($config_json_path);

our $XSEARCHPATH = $config->{xsearchpath};
our $SHAREDPATH = "$XSEARCHPATH/shared";
our $FILETYPESPATH = "$SHAREDPATH/filetypes.xml";
our $SEARCHOPTIONSPATH = "$SHAREDPATH/searchoptions.xml";

our @EXPORT = qw($XSEARCHPATH $SHAREDPATH $FILETYPESPATH $SEARCHOPTIONSPATH);

1;

__END__
{'fraction_non_alphanumeric': 0.320480404551201, 'fraction_numerical': 0.0025284450063211127, 'mean_word_length': 8.097701149425287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '1967646', 'n_tokens_mistral': 506, 'n_tokens_neox': 503, 'n_words': 101}