Saving Perl packages through local

In Perl there is an expression local. It substitutes the specified value with undef until the end of the block. The values can be global hashes, arrays and scalars, as well as elements or slices of hashes and scalars. The problem is that package hashes are not saved by local. By package hashes I mean a hash with a colon at the end (%Package::) which stores the package symbols (GLOB).

package A {
  sub fn {}
  $x = 10;
  @x = qw(1 2);

use DDP;
p %A::  # -> {
        #    fn   *A::fn  (layers: ),
        #    x    *A::x  (layers: )
        # }…