Carp-Capture
view release on metacpan or search on metacpan
lib/Carp/Capture.pm view on Meta::CPAN
# We could return the packstring to the user, as the representation of their
# callstack. Instead, we choose to employ the same strategy of hash-key
# storage with unique-integer identifier as value. The 'callstacks'
# attribute is a hash that holds callstack packstrings as keys. This means
# that the user is given a simple integer to track their callstack.
#
# There are two other reasons, besides binary avoidance at the user-level,
# for mapping packstrings with the Callstacks hash. Repeated callstacks
# happen whenever capturing is requested from a loop. By mapping callstacks
# we only have to store a repeated callstack once. We can also help the user
# identify loop iterations by offering storage for an 'annotation' value.
#
# If the user provides an annotation then we will need to save a copy of it,
# which we do pushing it onto an array - the 'annotations' attribute. The
# index of the new element becomes the annotation's id.
#
# We can't use the same (hash) strategy employed for components and pack
# strings because annotation values can be any kind of scalar including
# references and undefs; things that don't survive stringification needed for
# storage as hash keys.
#
( run in 0.704 second using v1.01-cache-2.11-cpan-71847e10f99 )