NAME

Salvation::Service::View::Stack::Parser - Salvation::Service::View::Stack parser

SYNOPSIS

 my %args = (
 	events => {
 		before_stack => sub{ ... },
 		after_stack  => sub{ ... },

 		before_node => sub{ ... },
 		after_node  => sub{ ... },

 		before_frame => sub{ ... },
 		after_frame  => sub{ ... },

 		before_frame_list => sub{ ... },
 		after_frame_list  => sub{ ... },

 		before_frame_single => sub{ ... },
 		after_frame_single  => sub{ ... },

 		raw => sub{ ... }
 	}
 );

 Salvation::Service::View::Stack
 	-> parse(
		$stack,
		\%args
	)
 ;

REQUIRES

Scalar::Util

Carp::Assert

METHODS

parse

Salvation::Service::View::Stack -> parse( $stack, \%args );

Parses a $stack which should be a Salvation::Service::View::Stack object instance and produces an output you want it to produce.

%args can contain event handlers, as shown at SYNOPSIS.

Event handler should be CodeRef. The only argument to event handler is $node which is the object which is the subject of current event.

Events are:

before_stack

Occurs when the parser is about to dive into Salvation::Service::View::Stack object instance.

after_stack

Occurs when the parser is about to leave Salvation::Service::View::Stack object instance.

before_node

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and just met an object to be parsed.

after_node

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and finished parsing an object.

before_frame

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and just met a Salvation::Service::View::Stack::Frame-derived object instance.

after_frame

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and finished parsing a Salvation::Service::View::Stack::Frame-derived object instance.

before_frame_list

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and just met a Salvation::Service::View::Stack::Frame-derived object instance which is_list call returns true.

after_frame_list

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and finished parsing a Salvation::Service::View::Stack::Frame-derived object instance which is_list call returns true.

before_frame_single

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and just met a Salvation::Service::View::Stack::Frame-derived object instance which is_list call returns false.

after_frame_single

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and finished parsing a Salvation::Service::View::Stack::Frame-derived object instance which is_list call returns false.

raw

Occurs when the parser has already dove into Salvation::Service::View::Stack object instance and just met a raw frame content.

Each %args key and each event handler is optional.