use 5.36.0; package Solution; use Moo; use Path::Tiny; has file => ( is => 'ro' ); has path_file => ( is => 'lazy', default => sub ($self) { path( $self->file ); } ); sub day_part ($self) { $self =~ /Part(\d)/g; return $1; } sub file_lines ($self) { $self->path_file->lines( { chomp => 1 } ); } sub file_slurp ($self) { my $content = $self->path_file->slurp; chomp $content; return $content; } has input => ( is => 'lazy', default => sub { ... } ); sub solve { ... } 1;