From: Yanick Champoux Date: Thu, 24 Jul 2008 17:04:54 +0000 (-0400) Subject: protection if there are no hooks registered yet X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6e053362f83d89b04e278d56a42ff8c03dd52eee;p=cil.git protection if there are no hooks registered yet --- 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 ); + } } }