sub test_141024 : Tests { my $cache = CHI->new( driver => 'RawMemory', global => 1 ); my $callback = sub { wantarray ? 'list' : 'scalar' }; my $scalar = $cache->compute( 1, undef, $callback ); my @array = $cache->compute( 2, undef, $callback ); is_deeply( $cache->get(1), 'scalar' ); is_deeply( $cache->get(2), ['list'] ); eval { my @array2 = $cache->compute( 1, undef, $callback ) }; like( $@, qr/Can't use string \("scalar"\) as an ARRAY ref while "strict refs"/ ); $cache->set( 3, ['in_list'] ); is_deeply( $cache->get(3), ['in_list'] ); my @foo = map $cache->compute( $_, undef, $callback ), 3, 4; is_deeply( $foo[0], 'in_list' ); is_deeply( $foo[1], 'list' ); }