From 6e053362f83d89b04e278d56a42ff8c03dd52eee Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Thu, 24 Jul 2008 13:04:54 -0400 Subject: [PATCH] protection if there are no hooks registered yet --- lib/CIL.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CIL.pm b/lib/CIL.pm index 42451a2..c433810 100644 --- a/lib/CIL.pm +++ b/lib/CIL.pm @@ -310,8 +310,10 @@ sub run_hook { } # call all the hooks with all the args - foreach my $code ( @{$self->hook->{$hook_name}} ) { - &$code( $self, @rest ); + if ( ref $self->hook eq 'HASH' ) { + foreach my $code ( @{$self->hook->{$hook_name}} ) { + &$code( $self, @rest ); + } } } -- 2.39.5