package Milkbone::Hooks;

use strict;
no strict 'refs';
use warnings;

use Milkbone;

# import is the only function in the Milkbone::Hooks package.  The import list
# passed to it specifies which hooks should be given aliases in the calling
# package.  For instance, suppose the following statement exists in package foo
#
#     use Milkbone::Hooks qw(load_options);
#
# Then load_options() will be an alias for hook("load_options") in package
# foo.

sub import
{
  my $caller = caller;
  my $package = shift;

  foreach my $hook (@_) {
    *{$caller . '::' . $hook} = sub { hook($hook); };
  }
}

1;