M: Added sanity check for $action argument of setHandler method.
This commit is contained in:
@@ -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.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user