<commit_before>#!perl -T

use Test::More;

use Log::Fine;
use Log::Fine::Handle::File;
use Log::Fine::Levels::Syslog;
use Log::Fine::Logger;

use FileHandle;
use POSIX qw(strftime);

{

        if ($^O ne "MSWin32") {
                plan skip_all => "Tests for MSWin32 environment only";
        } else {
                plan tests => 5;
        }

        my $file = sprintf("C:\\WINDOWS\\Temp\\log-fine-$$-%s",
                           strftime("%Y%m%d%H%M%S", localtime(time)));
        my $msg = "Smoke me a kipper, I'll be back for breakfast";

        # Get a logger
        my $log = Log::Fine->logger("windowstest0");

        isa_ok($log, "Log::Fine");

        # Add file handle
        my $handle =
            Log::Fine::Handle::File->new(file      => $file,
                                         autoflush => 1);

        isa_ok($handle, "Log::Fine::Handle");

        # Remove the file if it exists so as not to confuse ourselves
        unlink $file if -e $file;

        # Write a test message
        $handle->msgWrite(INFO, $msg, 1);

        ok(-f $file);
        $handle->fileHandle()->close();

        # Grab a ref to our filehandle
        my $fh = FileHandle->new($file);
        isa_ok($fh, "IO::File");

        # Read in the file
        while (<$fh>) {
                ok(/^\[.*?\] \w+ $msg/);
        }

        # Clean up
        $fh->close();
        unlink $file;

}<commit_msg>Use File::Temp::mkstemp() to create temporary file<commit_after>#!perl -T

#
# Note: The purpose of these tests is to ensure that Log::Fine is able
# to write out to a file with an absolute path under MSWin32 (e.g.,
# C:\WINDOWS\Temp\foo.log).  This does *not* include cygwin, which
# behaves more UNIX-y.
#

use Test::More;

use File::Temp qw/ :mktemp /;

use Log::Fine;
use Log::Fine::Handle::File;
use Log::Fine::Levels::Syslog;
use Log::Fine::Logger;

use FileHandle;
use POSIX qw(strftime);

{

        if ($^O ne "MSWin32") {
                plan skip_all => "Tests for MSWin32 environment only";
        } else {
                plan tests => 5;
        }

        my ($tempfh, $file) = mkstemp('C:\WINDOWS\Temp\LFXXXXXX');

        # We do not need $tempfh so close it
        $tempfh->close();

        my $msg = "Smoke me a kipper, I'll be back for breakfast";

        # Get a logger
        my $log = Log::Fine->logger("windowstest0");

        isa_ok($log, "Log::Fine");

        # Add file handle
        my $handle =
            Log::Fine::Handle::File->new(file      => $file,
                                         autoflush => 1);

        isa_ok($handle, "Log::Fine::Handle");

        # Remove the file if it exists so as not to confuse ourselves
        unlink $file if -e $file;

        # Write a test message
        $handle->msgWrite(INFO, $msg, 1);

        ok(-e $file);
        $handle->fileHandle()->close();

        # Grab a ref to our filehandle
        my $fh = FileHandle->new($file);
        isa_ok($fh, "IO::File");

        # Read in the file
        while (<$fh>) {
                ok(/^\[.*?\] \w+ $msg/);
        }

        # Clean up
        $fh->close();
        unlink $file;

}
{'fraction_non_alphanumeric': 0.15418923223956674, 'fraction_numerical': 0.005734310289901242, 'mean_word_length': 1.8237410071942446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1432432', 'n_tokens_mistral': 1073, 'n_tokens_neox': 974, 'n_words': 291}