Skip Menu |

This queue is for tickets about the Params-Util CPAN distribution.

Report information
The Basics
Id: 133158
Status: rejected
Priority: 0/
Queue: Params-Util

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.07
Fixed in: (no value)



Subject: XS version of _HASH fails on tied hashes
Perl v5.28.1 If the XS version of_HASH is passed a tied hash, it returns false. I've tried this with both Tie::IxHash and Readonly, with the same results: PERL_PARAMS_UTIL_PP=1 perl -MParams::Util=_HASH -MTie::IxHash \ -E '$t = tie(my %h, q(Tie::IxHash), 1, 2 ); say q(I am a ), ref \%h; say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' I am a HASH Does Params::Util agree? yes PERL_PARAMS_UTIL_PP=0 perl -MParams::Util=_HASH -MTie::IxHash \ -E '$t = tie(my %h, q(Tie::IxHash), 1, 2 ); say q(I am a ), ref \%h; say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' I am a HASH Does Params::Util agree? no Similarly with Readonly: PERL_PARAMS_UTIL_PP=1 perl -MParams::Util=_HASH -MReadonly \ -E 'Readonly::Hash my %h => ( 1, 2 ); say q(I am a ), ref \%h; say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' I am a HASH Does Params::Util agree? yes PERL_PARAMS_UTIL_PP=0 perl -MParams::Util=_HASH -MReadonly \ -E 'Readonly::Hash my %h => ( 1, 2 ); say q(I am a ), ref \%h; say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' I am a HASH Does Params::Util agree? no Thanks! Diab
On Fri Aug 14 09:58:19 2020, DJERIUS wrote: Show quoted text
> > Perl v5.28.1 > > If the XS version of_HASH is passed a tied hash, it returns false. > I've tried this with both Tie::IxHash and Readonly, with the same > results: > > PERL_PARAMS_UTIL_PP=1 perl -MParams::Util=_HASH -MTie::IxHash \ > -E '$t = tie(my %h, q(Tie::IxHash), 1, 2 ); say q(I am a ), ref \%h; > say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' > I am a HASH > Does Params::Util agree? yes > > PERL_PARAMS_UTIL_PP=0 perl -MParams::Util=_HASH -MTie::IxHash \ > -E '$t = tie(my %h, q(Tie::IxHash), 1, 2 ); say q(I am a ), ref \%h; > say q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' > I am a HASH > Does Params::Util agree? no > > Similarly with Readonly: > > > PERL_PARAMS_UTIL_PP=1 perl -MParams::Util=_HASH -MReadonly \ > -E 'Readonly::Hash my %h => ( 1, 2 ); say q(I am a ), ref \%h; say > q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' > I am a HASH > Does Params::Util agree? yes > > PERL_PARAMS_UTIL_PP=0 perl -MParams::Util=_HASH -MReadonly \ > -E 'Readonly::Hash my %h => ( 1, 2 ); say q(I am a ), ref \%h; say > q(Does Params::Util agree? ), _HASH(\%h) ? q(yes) : q(no)' > I am a HASH > Does Params::Util agree? no > > Thanks! > Diab
Looks for me as if the PP variant fails to determine it correctly, but I'll look deeper once toolchain is updated. Smells for a case for `_HASHLIKE`.
ECANTREPRODUCE $ env PERL_PARAMS_UTIL_PP=1 perl -Mblib -MDDP -MParams::Util=_HASH -MReadonly -e 'printf("%d\n", Params::Util::_XScompiled); my $h; Readonly $h => {foo => "bar"}; p($h); my $_h = _HASH($h); p($_h);' 0 "HASH(0x563d55fe9758)" (tied to Readonly::Scalar) \ { foo "bar" } $ env PERL_PARAMS_UTIL_PP=0 perl -Mblib -MDDP -MParams::Util=_HASH -MReadonly -e 'printf("%d\n", Params::Util::_XScompiled); my $h; Readonly $h => {foo => "bar"}; p($h); my $_h = _HASH($h); p($_h);' 1 "HASH(0x55affe150758)" (tied to Readonly::Scalar) \ { foo "bar" } Looks to me as if the objects you're using aren't hashes but behave like ones. Distinguish between is and like.