<commit_before>unit role Net::SMTP::Raw;

use MIME::Base64;
use Digest;
use Digest::HMAC;
use IO::Socket::SSL;

has $.conn is rw;

method get-response() {
    my $line = $.conn.get;
    my $response = $line;
    while $line.substr(3,1) ne ' ' {
        $line = $.conn.get;
        $response ~= "\r\n"~$line;
    }
    return $response;
}

method send($stuff) {
    $.conn.print($stuff ~ "\r\n");
    return self.get-response;
}

method ehlo($hostname = gethostname()) {
    return self.send("EHLO $hostname");
}

method helo($hostname = gethostname()) {
    return self.send("HELO $hostname");
}

method starttls() {
    return self.send("STARTTLS");
}
method switch-to-ssl() {
    $!conn = IO::Socket::SSL.new(:client-socket($.conn));
    $!conn.nl-in = "\r\n";
}

method mail-from($address) {
    return self.send("MAIL FROM:$address");
}

method rcpt-to($address) {
    return self.send("RCPT TO:$address");
}

method data() {<commit_msg>IO::Socket::SSL didn't change to nl-in<commit_after>unit role Net::SMTP::Raw;

use MIME::Base64;
use Digest;
use Digest::HMAC;
use IO::Socket::SSL;

has $.conn is rw;

method get-response() {
    my $line = $.conn.get;
    my $response = $line;
    while $line.substr(3,1) ne ' ' {
        $line = $.conn.get;
        $response ~= "\r\n"~$line;
    }
    return $response;
}

method send($stuff) {
    $.conn.print($stuff ~ "\r\n");
    return self.get-response;
}

method ehlo($hostname = gethostname()) {
    return self.send("EHLO $hostname");
}

method helo($hostname = gethostname()) {
    return self.send("HELO $hostname");
}

method starttls() {
    return self.send("STARTTLS");
}
method switch-to-ssl() {
    $!conn = IO::Socket::SSL.new(:client-socket($.conn));
    $!conn.input-line-separator = "\r\n";
}

method mail-from($address) {
    return self.send("MAIL FROM:$address");
}

method rcpt-to($address) {
    return self.send("RCPT TO:$address");
}

method data() {
{'fraction_non_alphanumeric': 0.20031217481789804, 'fraction_numerical': 0.004162330905306972, 'mean_word_length': 3.420689655172414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4970270', 'n_tokens_mistral': 714, 'n_tokens_neox': 722, 'n_words': 148}