lib/Chj/NamespaceCleanAbove.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 30 / 30 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/FP/Weak/t.pm ↑ Summary lib/Chj/singlequote/t.pm »
1 #
2 # Copyright (c) 2015 Christian Jaeger, copying@christianjaeger.ch
3 #
4 # This is free software, offered under either the same terms as perl 5
5 # or the terms of the Artistic License version 2 or the terms of the
6 # MIT License (Expat version). See the file COPYING.md that came
7 # bundled with this file.
8 #
9  
10 =head1 NAME
11  
12 Chj::NamespaceCleanAbove
13  
14 =head1 SYNOPSIS
15  
16 sub foo { }
17 use Bar;
18 use Chj::NamespaceCleanAbove; # imports `_END_`
19 sub baz {
20 bar foo
21 }
22 _END_; # deletes `foo` and everything imported by `Bar`, but still lets
23 # `baz` access them.
24  
25 =head1 DESCRIPTION
26  
27 =head1 TODO
28  
29 Reuse pieces of L<namespace::clean> or similar instead?
30  
31 =head1 SEE ALSO
32  
33 L<Chj::NamespaceClean>, L<namespace::clean>
34  
35 =head1 NOTE
36  
37 This is alpha software! Read the status section in the package README
38 or on the L<website|http://functional-perl.org/>.
39  
40 =cut
41  
42 package Chj::NamespaceCleanAbove;
43  
44 60 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 60 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 60 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 60 ▶use Chj::NamespaceClean;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 224 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
51 224 my $_importpackage = shift;
52 224 my $package = caller;
53 224 my $keys = package_keys $package;
54 60 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
55 224 ▶ *{"${package}::_END_"} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
56 213 package_delete $package, $keys;
57 213 1 # make _END_ work as the last statement in a module
58 224 };
59 }
60  
61 60 1
« lib/FP/Weak/t.pm ↑ Summary lib/Chj/singlequote/t.pm »