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) {