NAME

MPGA::Trace - Real-time flow execution tracer for MPGA

SYNOPSIS

use MPGA::Trace;

my $tracer = sub {
    my ($msg, $args, $flow) = @_;
    print "$msg | Flow size: " . scalar(@$flow) . "\n";
};

# Standard trace
flow_trace($flow_array, $ctx, $max_steps, $tracer);

# Context trace
flow_ctx_trace($flow_array, $tracer);

DESCRIPTION

This module provides decorators to monitor flow execution in real-time, hooking into execution before and after every function in the flow.

It safely uses typeglob aliasing to intercept calls without permanently altering the MPGA module namespace.

FUNCTIONS

flow_trace( $flow, [$ctx, $max_steps,] $tracer_coderef )

Executes a flow with tracing enabled. The tracer receives:

  • $msg - A string (e.g. "ВЫЗОВ: fun_name" or "ПОСЛЕ ВЫЗОВА")

  • $args - An array reference of arguments about to be passed

  • $flow - The current state of the flow

flow_ctx_trace( $flow, $tracer_coderef )

Identical to flow_trace, but extracts the first element of $flow and uses it as the shared context.

AUTHOR

Nikolay Neustroev (NN)

COPYRIGHT AND LICENSE

Copyright (C) 1997-2026 by Nikolay Neustroev.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.