<commit_before>#!/usr/bin/perl
package Jora::Commands::CreateTask;

use strict;
use warnings;

use Moose;
use Jora::Sqlite;
use Getopt::Long qw/GetOptionsFromArray/;
use Data::Dumper;

extends 'Jora::Commands::Command';

has 'name' => (
	is => 'ro',
	isa => 'Str',
	required => 1,
);

has ['subject', 'description'] => (
	is => 'ro',
	isa => 'Maybe[Str]',
);

around BUILDARGS => sub {
	print "child buildargs: ", Dumper(@_);
	my ($orig, $class, $argv) = (shift, shift, shift);
	my ($name, $subject, $description) = (shift @$argv, "", "");
	GetOptionsFromArray($argv, "s=s" => \$subject, "d=s" => \$description);
	print Dumper($subject, $description);
	return $class->$orig(@_, name => $name, subject => $subject, description => $description);
};

sub BUILD {
	print Dumper(shift);
}

sub execute {
	my $self = shift;
	print Dumper($self);
	Jora::Sqlite::create_task($self->name, $self->subject, $self->description);
}

1;<commit_msg>CreateTask: do not default-initialize command parameters<commit_after>#!/usr/bin/perl
package Jora::Commands::CreateTask;

use strict;
use warnings;

use Moose;
use Jora::Sqlite;
use Getopt::Long qw/GetOptionsFromArray/;
use Data::Dumper;

extends 'Jora::Commands::Command';

has 'name' => (
	is => 'ro',
	isa => 'Str',
	required => 1,
);

has ['subject', 'description'] => (
	is => 'ro',
	isa => 'Maybe[Str]',
);

around BUILDARGS => sub {
	print "child buildargs: ", Dumper(@_);
	my ($orig, $class, $argv) = (shift, shift, shift);
	my ($name, $subject, $description) = (shift @$argv);
	GetOptionsFromArray($argv, "s=s" => \$subject, "d=s" => \$description);
	print Dumper($subject, $description);
	return $class->$orig(@_, name => $name, subject => $subject, description => $description);
};

sub BUILD {
	print Dumper(shift);
}

sub execute {
	my $self = shift;
	print Dumper($self);
	Jora::Sqlite::create_task($self->name, $self->subject, $self->description);
}

1;
{'fraction_non_alphanumeric': 0.21019442984760903, 'fraction_numerical': 0.0021019442984760903, 'mean_word_length': 5.367892976588629, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '5365957', 'n_tokens_mistral': 696, 'n_tokens_neox': 689, 'n_words': 172}