fml 8 tutorial
Prev | Chapter 42. Hook | Next

# Hook Naming Convension

Hook standard form is

    ROLE_METHOD_start_hook
    ROLE_METHOD_end_hook

The role is "ROLE" part of $use_ROLE_function (e.g. $use_article_post_function) in configuration variables. This hook directory corresponds to some variables in configuration. More granular hooks do not match this rule.

For example, the main part of fmlconf command, run() method, provide the following hooks:

    fmlconf_run_start_hook
    fmlconf_run_end_hook

The actual code calling hooks as follows:

    sub run
    {
        my ($curproc, $args) = @_;
        my $config  = $curproc->{ config };

        my $eval = $config->get_hook( 'fmlconf_run_start_hook' );
        if ($eval) {
    	eval qq{ $eval; };
    	print STDERR $@ if $@;
        }

        $curproc->_fmlconf($args);

        $eval = $config->get_hook( 'fmlconf_run_end_hook' );
        if ($eval) {
    	eval qq{ $eval; };
    	print STDERR $@ if $@;
        }
    }

This case is fundamental. More granular hooks must be needed. The naming convension may differ from this convension.

Prev | Home | Next
Hook | Up | Recipes

fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
fml 4.0 project homepage is www.fml.org/software/fml4/.
about one floppy bsd routers, see www.bsdrouter.org/.
other free softwares are found at www.fml.org/software/.

author's homepage is www.fml.org/home/fukachan/.
Also, visit nuinui's world :) at www.nuinui.net.

For questions about FML, e-mail <fml-bugs@fml.org>.