| 1 | package YATT::Util::SymbolHash; | ||
| 2 | 13 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 13 | ▶ | use warnings qw(FATAL all NONFATAL misc); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 13 | ▶ | use Exporter qw(import); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 13 | our @EXPORT = qw(rebless_hash_with); | |
| 7 | |||
| 8 | 13 | ▶ | use Hash::Util qw(lock_keys unlock_keys); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | sub rebless_hash_with { |
|
Subroutine
rebless_hash_with: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 11 | 1 | my ($self, $newclass) = @_; | |
| 12 | 1 | unlock_keys(%$self); | |
| 13 | 1 | bless $self, $newclass; | |
| 14 | 1 | lock_keys(%$self, keys %{YATT::Util::Symbol::fields_hash_of_class($newclass)}); | |
| 15 | 1 | $self | |
| 16 | } | ||
| 17 | |||
| 18 | 13 | 1 | |