<commit_before>#!/usr/bin/perl -w

use strict;
use Test::More qw(no_plan);

use FindBin qw($Bin);
use File::Find;

my @modules;
my %uses;

finddepth(
	sub {
		m{^\w.*\.pm$} && do {
			my $module = $File::Find::name;
			$module =~ s{.*/lib.}{};
			$module =~ s{[/\\]}{::}g;
			$module =~ s{.pm$}{};
			push @modules, $module;
			open MODULE, "<", $_ or die "Failed to open ($_): $!";
			while (<MODULE>) {
				if (m{^use (\S+);}) {
					$uses{$module}{$1}++;
				}
				if (m{^(?:extends|with) (.*)}) {
					my $arg = $1;
					my @list =( )= eval($arg);
					if (!@list) {
						@list = $arg =~ m{([\w:]+)}g;
					}
					$uses{$_}{$module}++ for @list;
				}
			}<commit_msg>Skip POD when parsing Perl<commit_after>#!/usr/bin/perl -w

use strict;
use Test::More qw(no_plan);

use FindBin qw($Bin);
use File::Find;

my @modules;
my %uses;

finddepth(
	sub {
		m{^\w.*\.pm$} && do {
			my $module = $File::Find::name;
			$module =~ s{.*/lib.}{};
			$module =~ s{[/\\]}{::}g;
			$module =~ s{.pm$}{};
			push @modules, $module;
			open MODULE, "<", $_ or die "Failed to open ($_): $!";
			while (<MODULE>) {
				next if (m{^=(?!cut)\w+} ... m{^=cut});
				if (m{^use (\S+);}) {
					$uses{$module}{$1}++;
				}
				if (m{^(?:extends|with) (.*)}) {
					my $arg = $1;
					my @list =( )= eval($arg);
					if (!@list) {
						@list = $arg =~ m{([\w:]+)}g;
					}
					$uses{$_}{$module}++ for @list;
				}
			}
{'fraction_non_alphanumeric': 0.28937990021382753, 'fraction_numerical': 0.002851033499643621, 'mean_word_length': 2.6, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7002990', 'n_tokens_mistral': 747, 'n_tokens_neox': 607, 'n_words': 130}