$ perl -MMojo::DOM -E 'my $dom = Mojo::DOM::->new("

"); my $x = $dom->at("p.missing")->text(); say defined $x ? "not missing" : "really missing"' Can't call method "text" on an undefined value at -e line 1.