Server IP : 85.214.239.14 / Your IP : 3.139.235.100 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/proc/3/cwd/usr/share/perl5/B/Hooks/EndOfScope/PP/ |
Upload File : |
# Implementation of a pure-perl on_scope_end for perls > 5.10 # (relies on Hash::Util:FieldHash) package # hide from pause B::Hooks::EndOfScope::PP::FieldHash; use strict; use warnings; our $VERSION = '0.26'; use Tie::Hash (); use Hash::Util::FieldHash 'fieldhash'; # Here we rely on a combination of several behaviors: # # * %^H is deallocated on scope exit, so any references to it disappear # * A lost weakref in a fieldhash causes the corresponding key to be deleted # * Deletion of a key on a tied hash triggers DELETE # # Therefore the DELETE of a tied fieldhash containing a %^H reference will # be the hook to fire all our callbacks. fieldhash my %hh; { package # hide from pause too B::Hooks::EndOfScope::PP::_TieHintHashFieldHash; our @ISA = ( 'Tie::StdHash' ); # in Tie::Hash, in core sub DELETE { my $ret = shift->SUPER::DELETE(@_); B::Hooks::EndOfScope::PP::__invoke_callback($_) for @$ret; $ret; } } sub on_scope_end (&) { $^H |= 0x020000; tie(%hh, 'B::Hooks::EndOfScope::PP::_TieHintHashFieldHash') unless tied %hh; push @{ $hh{\%^H} ||= [] }, $_[0]; } 1;