The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Muster::Hook - Muster hook base class

VERSION

version 0.62

SYNOPSIS

  # CamelCase plugin name
  package Muster::Hook::MyHook;
  use Mojo::Base 'Muster::Hook';

  sub register {
      my $self = shift;
      my $hookmaster = shift;
      my $conf = $shift;

      return $self;
  }

  sub process {
    my $self = shift;
    my %args = @_;

    # Magic here! :)

    return $leaf;
  }

DESCRIPTION

Muster::Hook is an abstract base class for Muster hooks.

A hook will be used in both the scanning phase and the assembly phase, so it needs to be told which it is.

METHODS

Muster::Hook inherits all methods from Mojo::Base and implements the following new ones.

register

Initialize, and register hooks.

process

Process (scan or modify) a leaf object. In scanning phase, it may update the meta-data, in modify phase, it may update the content. May leave the leaf untouched.

  my $new_leaf = $self->process(leaf=>$leaf,phase=>$phase);