NAME

Devel::Walk::Unstorable - Find locations in complex structures that can't be serialized with Storable.

SYNOPSIS

use Devel::Walk::Unstorable;

my @list = unstorable( $suspect, '$suspect' );
die "Can't store ", join "\n", @list if @list;

DESCRIPTION

This module uses Devel::Walk to find all the locations of objects that can't be stored with "freeze" in Storable.

unstorable

my @bad = unstorable( $obj, $basename );

Walks $obj and finds all the locations that can't be stored with "freeze" in Storable. Returns the list of locations, if any.

$basename may be omited and defaults to '$o'.

OBJECT

You might want to customize the behaviour of this module. If so, you can subclass Devel::Walk::Unstorable and overload one of the worker modules.

my $walker = Devel::Walk::Unstorable->new;
$walker->walk( $obj, $name );
my @bad = $walker->list;

new

my $walker = Devel::Walk::Unstorable->new;

walk

$walker->walk( $struct, '$basename' );

Recursely walks through $suspect, invoking "check" on each element of each structure. $basename is updated with each recursion to be. Only walks through ARRAY, HASH, SCALAR and REF references.

All locations that fail "check" will be accumulated in a list. The list will only contain the deepest locations.

If $basename is empty, '$o' is used as a default.

list

my @bad = $walker->list;

Returns the list of location that failed "check".

check

my $ok = $walker->check( $loc, $obj );

By default, check will return true if $obj is a reference that fails to be serialized with "freeze" in Storable. Returns false if $obj is not a reference, or if it's a reference that can be sucessfully serialized with "freeze" in Storable.

SEE ALSO

Devel::Walk Storable

AUTHOR

Philip Gwyn, <fil-at-pied.nu>

COPYRIGHT AND LICENSE

Copyright (C) 2025 by Philip Gwyn

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.26.3 or, at your option, any later version of Perl 5 you may have available.