```{index} single: stack_depth; Storable function ``` ```{index} single: Storable::stack_depth; Perl function ``` # stack_depth Return the current scalar recursion limit used while freezing and thawing. ## Synopsis ```perl use Storable; my $d = Storable::stack_depth(); ``` ## What you get back The integer value of `$Storable::recursion_limit`. This is the maximum nesting depth the serialiser will follow before aborting with a recursion error. The default is `512`; assigning to `$Storable::recursion_limit` changes what the next call returns. ## Examples Raise the limit for a particularly deep structure: ```perl local $Storable::recursion_limit = 4096; my $bytes = freeze($deep_tree); ``` ## Edge cases - Zero or negative values of `$Storable::recursion_limit` are treated as the default `512` when serialising. ## Differences from upstream Fully compatible with upstream. Pinned by `t/81-xs-native/Storable/240-stack-depth.t`. ## See also - `stack_depth_hash` — the separate limit used for hash serialisation. - `freeze` / `thaw` — the consumers of this limit.