to check that one is a subset of the other. */
(void) hv_iterinit(hv);
while ( (he = hv_iternext(hv)) ) {
- I32 key_len;
- char * const key = hv_iterkey(he, &key_len);
+ SV *key = hv_iterkeysv(he);
++ this_key_count;
- if(!hv_exists(other_hv, key, key_len)) {
+ if(!hv_exists_ent(other_hv, key, 0)) {
(void) hv_iterinit(hv); /* reset iterator */
RETPUSHNO;
}
for (i = 0; i < other_len; ++i) {
SV ** const svp = av_fetch(other_av, i, FALSE);
- char *key;
- STRLEN key_len;
-
if (svp) { /* ??? When can this not happen? */
- key = SvPV(*svp, key_len);
- if (hv_exists(hv, key, key_len))
+ if (hv_exists_ent(hv, *svp, 0))
RETPUSHYES;
}
}
for (i = 0; i < other_len; ++i) {
SV ** const svp = av_fetch(other_av, i, FALSE);
- char *key;
- STRLEN key_len;
-
if (svp) { /* ??? When can this not happen? */
- key = SvPV(*svp, key_len);
- if (hv_exists(MUTABLE_HV(SvRV(d)), key, key_len))
+ if (hv_exists_ent(MUTABLE_HV(SvRV(d)), *svp, 0))
RETPUSHYES;
}
}
use Tie::Array;
use Tie::Hash;
+use Tie::RefHash;
# Predeclare vars used in the tests:
my @empty;
our $ov_obj = Test::Object::WithOverload->new;
our $obj = Test::Object::NoOverload->new;
+tie my %refh, 'Tie::RefHash';
+$refh{$ov_obj} = 1;
+
my @keyandmore = qw(key and more);
my @fooormore = qw(foo or more);
my %keyandmore = map { $_ => 0 } @keyandmore;
= %hash %tied_hash
%tied_hash %tied_hash
!= {"a"=>"b"} %tied_hash
+ $ov_obj %refh
+! "$ov_obj" %refh
+ [$ov_obj] %refh
+! ["$ov_obj"] %refh
+ %refh %refh
# - an array ref
# (since this is symmetrical, tests as well hash~~array)