p5pclub / ref-util

Ref::Util - Utility functions for checking references
6 stars 11 forks source link

`is_magical` for variables that have magic? #7

Closed xsawyerx closed 8 years ago

xsawyerx commented 8 years ago

Variables that aren't references fail on all Ref::Util functions (because it isn't a reference), but having a simple function to check if something has magic or not.

I'm not sure it's useful though, or if it fits Ref::Util.

@plicease, @ilmari, what do you think?

plicease commented 8 years ago

I probably wouldn't use it often.

xsawyerx commented 8 years ago

@kaoru, have you some thoughts on this?

kaoru commented 8 years ago

@xsawyerx thinking about it, I don't think I'd use it often either. It doesn't solve the Readonly::XS issue because is_hashref() still wouldn't return true for something that returns true for ref $_ eq ref {}, and it wouldn't be safe to do is_magical($_) || is_hashref($_) as the check.

I think the Readonly::XS case just warrants some documentation warning that the two moduels don't play nicely with one another.

xsawyerx commented 8 years ago

@kaoru Thank you for the feedback.

The latest version details this problem.

I'm thus closing this issue. :)