# App.pm package App; use Foo; sub new { my $class = shift; bless { ua => Foo->new }, $class; } sub check { my $self = shift; my $res = $self->{ua}->get('https://perlmonks.org'); if ($res->code != 200) { return "Monks are offline"; } return "Everything works just fine"; } 1;