From d9ea2d78c415b67e6d8636611337fec4afc7a805 Mon Sep 17 00:00:00 2001 From: swag Date: Fri, 22 Apr 2022 12:44:19 -0400 Subject: [PATCH] Some smol tweaks to appease `perlcritic` --- guestbook-ng.pl | 4 +++- lib/GuestbookNg/Model/Counter.pm | 2 +- lib/GuestbookNg/Model/Message.pm | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/guestbook-ng.pl b/guestbook-ng.pl index d8fedf9..3bf9f3c 100755 --- a/guestbook-ng.pl +++ b/guestbook-ng.pl @@ -62,7 +62,9 @@ under sub ($c) { get '/' => sub ($c) { $c->redirect_to(page => {page => 'view'}) }; any [qw{GET POST}], '/sign' => sub ($c) { - my $v = $c->validation() if $c->req->method eq 'POST'; + my $v; + + $v = $c->validation() if $c->req->method eq 'POST'; if ($v && $v->has_data) { my $name = $c->param('name') || 'Anonymous'; diff --git a/lib/GuestbookNg/Model/Counter.pm b/lib/GuestbookNg/Model/Counter.pm index e99b751..057f1d6 100644 --- a/lib/GuestbookNg/Model/Counter.pm +++ b/lib/GuestbookNg/Model/Counter.pm @@ -7,7 +7,7 @@ use Mojo::Base -base, -signatures; has 'pg'; sub new($class, $pg, $pg_object) { - bless {$pg => $pg_object} + bless {$pg => $pg_object}, $class } sub get_visitor_count($self) { diff --git a/lib/GuestbookNg/Model/Message.pm b/lib/GuestbookNg/Model/Message.pm index 6943190..9d19a64 100644 --- a/lib/GuestbookNg/Model/Message.pm +++ b/lib/GuestbookNg/Model/Message.pm @@ -10,7 +10,7 @@ sub new($class, $pg, $pg_object) { bless { $pg => $pg_object, max_posts => 5 - } + }, $class } sub get_posts($self, $this_page = undef) {