package Thing; use Moo; has topdir => ( is => 'rw', required => 1, ); use strict; use warnings; use Function::Parameters; # Methods method loop() { while (1) { my $val = rand(100); if ($val > 80) { # Do nothing if value is over 80 nnext; # This line has the actual error } ($val < 20) and return $val; } } method getcwd() { my $cwd = $self->topdir; return $cwd; }