Stop using smartmatch (#15) and add 5.20 features (part of #13)

This commit is contained in:
ngoomie 2024-08-19 02:13:01 -06:00
parent 44eeaa80e6
commit 1b179fb08d
20 changed files with 43 additions and 22 deletions

View File

@ -3,7 +3,8 @@ package CharmBoard;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious', -signatures; use Mojo::Base 'Mojolicious', -signatures;
use CharmBoard::Model::Schema; use CharmBoard::Model::Schema;
@ -37,11 +38,11 @@ sub startup {
# ? this could maybe be a given/when # ? this could maybe be a given/when
{ {
my ($_dsn, $_unicode); my ($_dsn, $_unicode);
if ($self->config->{database}->{type} ~~ 'sqlite') { if (lc($self->config->{database}->{type}) eq 'sqlite') {
$_dsn = "dbi:SQLite:" . $config->{database}->{name}; $_dsn = "dbi:SQLite:" . $config->{database}->{name};
$_unicode = "sqlite_unicode" $_unicode = "sqlite_unicode"
} elsif ($self->config->{database}->{type} ~~ 'mariadb') { } elsif (lc($self->config->{database}->{type}) eq 'mariadb') {
$_dsn = "dbi:mysql:" . $config->{database}->{name}; $_dsn = "dbi:mysql:" . $config->{database}->{name};
$_unicode = "mysql_enable_utf" $_unicode = "mysql_enable_utf"

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::Index;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;
use Tree::Simple; use Tree::Simple;

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::Login;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;
use CharmBoard::Model::Crypt::Password; use CharmBoard::Model::Crypt::Password;

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::Logout;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::NewThread;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::Register;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;
use CharmBoard::Model::Crypt::Password; use CharmBoard::Model::Crypt::Password;
@ -54,6 +55,7 @@ sub register_do {
$emailCheck = $self->schema->resultset('Users') $emailCheck = $self->schema->resultset('Users')
->search({ email => $email })->single; ->search({ email => $email })->single;
# TODO: compress this into something less redundant
($userCheck && $emailCheck) eq undef ($userCheck && $emailCheck) eq undef
or die "Username already in use.\nemail already in use."; or die "Username already in use.\nemail already in use.";
($userCheck) eq undef ($userCheck) eq undef

View File

@ -3,7 +3,8 @@ package CharmBoard::Controller::ViewSubf;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Crypt::Password;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Authen::Passphrase::Argon2; use Authen::Passphrase::Argon2;
use CharmBoard::Model::Crypt::Seasoning; use CharmBoard::Model::Crypt::Seasoning;

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Crypt::Seasoning;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Math::Random::Secure qw(irand); use Math::Random::Secure qw(irand);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Schema); use base qw(DBIx::Class::Schema);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Set::Categories;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base 'DBIx::Class::ResultSet'; use base 'DBIx::Class::ResultSet';

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Set::Subforums;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base 'DBIx::Class::ResultSet'; use base 'DBIx::Class::ResultSet';

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Set::Threads;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base 'DBIx::Class::ResultSet'; use base 'DBIx::Class::ResultSet';

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Categories;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Posts;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Session;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Subforums;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Threads;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@ package CharmBoard::Model::Schema::Source::Users;
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use base qw(DBIx::Class::Core); use base qw(DBIx::Class::Core);

View File

@ -3,7 +3,8 @@
use utf8; use utf8;
use strict; use strict;
use warnings; use warnings;
use experimental qw(try smartmatch); use experimental qw(try);
use feature ':5.20';
use Mojo::File qw(curfile); use Mojo::File qw(curfile);
use lib curfile->dirname->sibling('lib')->to_string; use lib curfile->dirname->sibling('lib')->to_string;