Devel-CompileLevel
view release on metacpan or search on metacpan
Devel::CompileLevel - Detect caller level of compiling code
SYNOPSIS
package ExportToCompile;
use strict;
use warnings;
use Devel::CompileLevel qw(compile_caller);
sub import {
my $target = compile_caller or die "not compiling!";
strict->import;
warnings->import;
no strict 'refs';
# will export to same level as strict/warnings are applied to
*{"${target}::exported_sub"} = sub { ... };
}
DESCRIPTION
Detects the caller level where compilation is being performed. When
applying pragmas in an import sub, they will be applied to the currently
compiling scope. Some modules may want to both apply a pragma, and
lib/Devel/CompileLevel.pm view on Meta::CPAN
=head1 SYNOPSIS
package ExportToCompile;
use strict;
use warnings;
use Devel::CompileLevel qw(compile_caller);
sub import {
my $target = compile_caller or die "not compiling!";
strict->import;
warnings->import;
no strict 'refs';
# will export to same level as strict/warnings are applied to
*{"${target}::exported_sub"} = sub { ... };
}
=head1 DESCRIPTION
Detects the caller level where compilation is being performed. When applying
pragmas in an import sub, they will be applied to the currently compiling scope.
( run in 0.473 second using v1.01-cache-2.11-cpan-299005ec8e3 )