From b4ac22ff03c95b0a2da0131b2fb3134b27379570 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 8 Feb 2015 14:45:10 +0200 Subject: [PATCH 1/1] Get rid of safe_can_nodie --- lib/Gruntmaster/Daemon.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index 880c0da..4f3360c 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -35,19 +35,13 @@ use constant FORMAT_EXTENSION => { my $db; -sub safe_can_nodie { +sub safe_can { my ($type, $sub, $name) = @_; return unless $name =~ /^\w+$/s; my $pkg = __PACKAGE__ . "::${type}::${name}"; eval "require $pkg" or get_logger->warn("Error while requiring $pkg: $@"); - $pkg->can($sub); -} - -sub safe_can { - my ($type, $sub, $name) = @_; - - safe_can_nodie @_ or get_logger->logdie("No such \l$type: '$name'"); + $pkg->can($sub) or get_logger->logdie("No such \l$type: '$name'"); } sub process{ -- 2.39.2