package Test::Deep::ArrayEachOrHash; use strict; use warnings; use Test::Deep::Cmp; sub init { my $self = shift; my $val = shift; $self->{val} = $val; } sub descend { my $self = shift; my $got = shift; my $result; if ( ref($got) eq "ARRAY" ) { my $exp = [ ($self->{val}) x @$got ]; $result = Test::Deep::descend($got, $exp); } else { my $exp = $self->{val}; $result = Test::Deep::descend($got, \%$exp); } return $result; } 1;