NAME

PiFlash::Plugin - plugin extension interface for PiFlash

VERSION

version 0.3.0

SYNOPSIS

 package PiFlash::Plugin::Example;
 use parent 'PiFlash::Plugin';

 # optional init class method - if defined it will be called upon creation of the plugin object
 sub init
 {
	my $self = shift;

	# perform any object initialization actions here
	$self->{data} = "value";

	# example: subscribe to PiFlash::Hook callbacks
	PiFlash::Hook::add("fs_mount", sub { ... code to run on callback ... });
	PiFlash::Hook::add("post_install", \&function_name);
 }

 # get a reference to the plugin's instance variable & data (same as $self in the init function)
 my $data = PiFlash::Plugin::Example->get_data;

DESCRIPTION

The PiFlash::Plugin module has class methods which manage all the plugins and
instance methods which are the base class inherited by each plugin.  L<PiFlash::Hook>
can be used to receive callback events at various stages of the PiFlash run.

To create a plugin for PiFlash, write a new class under the namespace of PiFlash::Plugin,
such as PiFlash::Plugin::Example.  All PiFlash plugins must be named under and inherit
from PiFlash::Plugin. Otherwise they will not be enabled or accessible.

If the plugin class contains or inherits an init() method, it will be called when the
plugin object is created. You don't need to write a new() routine, and shouldn't, because
PiFlash::Plugin provides one which must be used by all plugins. That will be called by
PiFlash during plugin initialization.

SEE ALSO

piflash, PiFlash::State, PiFlash::Hook,

AUTHOR

Ian Kluft <cpan-dev@iankluft.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017-2019 by Ian Kluft.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004