NAME
Context::Singleton::Frame - Internal representation of Context::Singleton's frame
DESCRIPTION
This is internal package.
EXTENDING FRAME
Each Context::Singleton::Frame (sub)class tracks its own current frame, so alternate implementations - e.g. selected via use Context::Singleton { frame_class => q (My::Frame) } - don't interfere with Context::Singleton::Frame's (or each other's) state.
_generate_frame_class_internals ()
package My::Frame;
use Moo;
BEGIN { extends q (Context::Singleton::Frame) }
BEGIN { __PACKAGE__->_generate_frame_class_internals }
Installs a _localisable_current_frame method into the calling class, backed by its own arrayref slot holding the current frame instance.
current_frame () and frame {} both resolve _localisable_current_frame through regular method dispatch, so:
A class calling
_generate_frame_class_internalsgets its own current frame, independent of its parent class.A subclass which doesn't call it inherits its parent's
_localisable_current_frameand therefore shares its parent's current frame.
Context::Singleton::Frame calls _generate_frame_class_internals on itself when the module is loaded, so it always has its own state, even before any subclass exists.
An optional frame (or class) to seed the slot with may be passed; it defaults to the invocant.
AUTHOR
Branislav Zahradník <barney.cpan@gmail.com>
COPYRIGHT AND LICENCE
This module is part of Context::Singleton distribution.