NAME

Form::Tiny::Hook - a representation of a hook

SYNOPSIS

# in your form class

# the following will be coerced into Form::Tiny::Hook
form_hook before_validation => $coderef;

DESCRIPTION

This is a simple class which stores a hook type together with a code reference which will be fired on that stage. See "Hooks" in Form::Tiny::Manual for details.

ATTRIBUTES

hook

A hook type. Currently available types are: reformat before_mangle before_validate after_validate cleanup after_error.

Required.

code

A code reference accepting varying arguments depending on hook type.

Required.

inherited

A boolean - whether the hook should be inherited to child forms. True by default.

METHODS

is_modifying

Given a hook object, this method will return a boolean value which indicates whether the hook is meant to be modifying the passed in value. If false, we should discard the return value of that hook's code reference.