← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 13:01:18 2016
Reported on Fri Jan 8 13:01:34 2016

Filename/usr/share/perl5/B/Hooks/EndOfScope/XS.pm
StatementsExecuted 0 statements in 0s
Line State
ments
Time
on line
Calls Time
in subs
Code
1package B::Hooks::EndOfScope::XS;
2{
3 $B::Hooks::EndOfScope::XS::VERSION = '0.13';
4}
5BEGIN {
6 $B::Hooks::EndOfScope::XS::AUTHORITY = 'cpan:FLORA';
7}
8# ABSTRACT: Execute code after a scope finished compilation - XS implementation
9
10use strict;
11use warnings;
12
13BEGIN {
14 require Module::Runtime;
15 # Adjust the Makefile.PL if changing this minimum version
16 Module::Runtime::use_module('Variable::Magic', '0.48');
17}
18
19use Sub::Exporter::Progressive -setup => {
20 exports => ['on_scope_end'],
21 groups => { default => ['on_scope_end'] },
22};
23
24my $wiz = Variable::Magic::wizard
25 data => sub { [$_[1]] },
26 free => sub { $_->() for @{ $_[1] }; () },
27 # When someone localise %^H, our magic doesn't want to be copied
28 # down. We want it to be around only for the scope we've initially
29 # attached ourselfs to. Merely having MGf_LOCAL and a noop svt_local
30 # callback achieves this. If anything wants to attach more magic of our
31 # kind to a localised %^H, things will continue to just work as we'll be
32 # attached with a new and empty callback list.
33 local => \undef
34;
35
36sub on_scope_end (&) {
37 my $cb = shift;
38
39 $^H |= 0x020000;
40
41 if (my $stack = Variable::Magic::getdata %^H, $wiz) {
42 push @{ $stack }, $cb;
43 }
44 else {
4528103µs Variable::Magic::cast %^H, $wiz, $cb;
# spent 103µs making 28 calls to B::Hooks::EndOfScope::XS::__ANON__, avg 4µs/call
46 }
47}
48
- -
511;
52
53__END__
54
55=pod
56
57=encoding UTF-8
58
59=for :stopwords Florian Ragwitz Peter Rabbitson
60
61=head1 NAME
62
63B::Hooks::EndOfScope::XS - Execute code after a scope finished compilation - XS implementation
64
65=head1 VERSION
66
67version 0.13
68
69=head1 DESCRIPTION
70
71This is the implementation of L<B::Hooks::EndOfScope> based on
72L<Variable::Magic>, which is an XS module dependent on a compiler. It will
73always be automatically preferred if L<Variable::Magic> is available.
74
75=head1 FUNCTIONS
76
77=head2 on_scope_end
78
79 on_scope_end { ... };
80
81 on_scope_end $code;
82
83Registers C<$code> to be executed after the surrounding scope has been
84compiled.
85
86This is exported by default. See L<Sub::Exporter> on how to customize it.
87
88=head1 AUTHORS
89
90=over 4
91
92=item *
93
94Florian Ragwitz <rafl@debian.org>
95
96=item *
97
98Peter Rabbitson <ribasushi@cpan.org>
99
100=back
101
102=head1 COPYRIGHT AND LICENSE
103
104This software is copyright (c) 2008 by Florian Ragwitz.
105
106This is free software; you can redistribute it and/or modify it under
107the same terms as the Perl 5 programming language system itself.
108
109=cut