M: Added sanity check for $action argument of setHandler method.

This commit is contained in:
Jens Luedicke
2012-09-02 19:23:32 +02:00
parent 6b24a7950b
commit 1c890bec84

View File

@@ -49,6 +49,10 @@ sub new {
sub setHandler { sub setHandler {
my ($self,$action,$func) = @_; my ($self,$action,$func) = @_;
if ($action !~ /onBeginWalk|onLink|onFile|onDirEnter|onDirLeave/) {
croak("Invalid action argument: $action");
}
if (ref($func) ne 'CODE') { if (ref($func) ne 'CODE') {
croak("Second argument must be CODE reference."); croak("Second argument must be CODE reference.");
} }