chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan( tests => 56 );
+ plan( tests => 78 );
}
my @c;
print "# caller can now return the compile time state of %^H\n";
-sub get_hash {
+sub hint_exists {
+ my $key = shift;
my $level = shift;
my @results = caller($level||0);
- $results[10];
+ exists $results[10]->{$key};
}
-sub get_dooot {
+sub hint_fetch {
+ my $key = shift;
my $level = shift;
my @results = caller($level||0);
- $results[10]->{dooot};
+ $results[10]->{$key};
}
-sub get_thikoosh {
- my $level = shift;
- my @results = caller($level||0);
- $results[10]->{thikoosh};
-}
+$::testing_caller = 1;
-sub dooot {
- is(get_dooot(), undef);
- is(get_thikoosh(), undef);
- my $hash = get_hash();
- ok(!exists $hash->{dooot});
- ok(!exists $hash->{thikoosh});
- 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);
- is(get_thikoosh(), undef);
- BEGIN {
- $^H{dooot} = 1;
- $^H{thikoosh} = "SKREECH";
- }
- is(get_dooot(), 1);
- is(get_thikoosh(), "SKREECH");
-
- BEGIN {
- $^H{dooot} = 42;
- }
- {
- {
- BEGIN {
- $^H{dooot} = 6 * 9;
- }
- is(get_dooot(), 54);
- is(get_thikoosh(), "SKREECH");
- {
- BEGIN {
- delete $^H{dooot};
- }
- is(get_dooot(), undef);
- my $hash = get_hash();
- ok(!exists $hash->{dooot});
- is(get_thikoosh(), "SKREECH");
- }
- dooot();
- }
- is(get_dooot(), 6 * 7);
- is(get_thikoosh(), "SKREECH");
- }
- is(get_dooot(), 6 * 7);
- is(get_thikoosh(), "SKREECH");
-}
+do './op/caller.pl';