From a0e934a667e05d3a8b5556e257938472cd9d6243 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 1 Aug 2011 23:43:45 -0500 Subject: stop compiling stuff in the Eval::Closure package directly --- t/compiling-package.t | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 t/compiling-package.t (limited to 't') diff --git a/t/compiling-package.t b/t/compiling-package.t new file mode 100644 index 0000000..5c3764f --- /dev/null +++ b/t/compiling-package.t @@ -0,0 +1,17 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Eval::Closure; + +my $code = eval_closure( + source => 'no strict "refs"; sub { keys %{__PACKAGE__ . "::"} }', +); + +# defining the sub { } creates __ANON__, calling 'no strict' creates BEGIN +my @stash_keys = grep { $_ ne '__ANON__' && $_ ne 'BEGIN' } $code->(); + +is_deeply([@stash_keys], [], "compiled in an empty package"); + +done_testing; -- cgit v1.2.3-54-g00ecf