libwww-perl / URI

The Perl URI module
https://metacpan.org/pod/URI
Other
57 stars 48 forks source link

use Scalar::Util::reftype instead of ref to check for ARRAY #132

Closed jackdeguest closed 9 months ago

jackdeguest commented 1 year ago

URI::_query uses ref to check if a value is an array, but since the URI distribution uses already Scalar::Util, I propose it uses Scalar::Util::reftype instead.

abraxxa commented 9 months ago

Can someone please explain what the advantage of Scalar::Util::reftype over ref has? Its docs don't have a comparison. Thanks!

jackdeguest commented 9 months ago

Can someone please explain what the advantage of Scalar::Util::reftype over ref has? Its docs don't have a comparison.

Array objects. ref will return the object class whereas Scalar::Util::reftype will return the actual type.

abraxxa commented 9 months ago

Thanks!

haarg commented 9 months ago

Changing to reftype means it will violate the encapsulation of any object that happens to be array based.

jackdeguest commented 9 months ago

Changing to reftype means it will violate the encapsulation of any object that happens to be array based.

Can you please clarify your thoughts in the context of the code in question?