chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan( tests => 48 );
+ plan( tests => 78 );
}
my @c;
is( $i, 11, 'do not skip over eval even if $^P had been on at some point' );
is( eval 'pb()', 'main::pb', 'actually return the right function name even if $^P had been on at some point' );
-# caller can now return the compile time state of %^H
-sub get_dooot {
+print "# caller can now return the compile time state of %^H\n";
+
+sub hint_exists {
+ my $key = shift;
my $level = shift;
my @results = caller($level||0);
- $results[10]->{dooot};
+ exists $results[10]->{$key};
}
-sub get_hash {
+
+sub hint_fetch {
+ my $key = shift;
my $level = shift;
my @results = caller($level||0);
- $results[10];
-}
-sub dooot {
- is(get_dooot(), undef);
- my $hash = get_hash();
- ok(!exists $hash->{dooot});
- is(get_dooot(1), 54);
- BEGIN {
- $^H{dooot} = 42;
- }
- is(get_dooot(), 6 * 7);
- is(get_dooot(1), 54);
-
- BEGIN {
- $^H{dooot} = undef;
- }
- is(get_dooot(), undef);
- $hash = get_hash();
- ok(exists $hash->{dooot});
-
- BEGIN {
- delete $^H{dooot};
- }
- is(get_dooot(), undef);
- $hash = get_hash();
- ok(!exists $hash->{dooot});
- is(get_dooot(1), 54);
-}
-{
- is(get_dooot(), undef);
- BEGIN {
- $^H{dooot} = 1;
- }
- is(get_dooot(), 1);
-
- BEGIN {
- $^H{dooot} = 42;
- }
- {
- {
- BEGIN {
- $^H{dooot} = 6 * 9;
- }
- is(get_dooot(), 54);
- {
- BEGIN {
- delete $^H{dooot};
- }
- is(get_dooot(), undef);
- my $hash = get_hash();
- ok(!exists $hash->{dooot});
- }
- dooot();
- }
- is(get_dooot(), 6 * 7);
- }
- is(get_dooot(), 6 * 7);
+ $results[10]->{$key};
}
+
+$::testing_caller = 1;
+
+do './op/caller.pl';