Perl-Toolchain-Gang / CPAN-Meta-Requirements

a set of version requirements for a CPAN dist
5 stars 15 forks source link

Remove Scalar::Util dependency #16

Closed mohawk2 closed 9 years ago

mohawk2 commented 9 years ago

This is intended to solve a problem for EUMM: it depends on CMR, which depends on Scalar::Util, which depends on EUMM to install itself. This is a problem in Perl core. Switching to using ref instead of Scalar::Util::blessed eliminates this problem, and doesn't seem to lose anything.

dagolden commented 9 years ago

Calling a method on an unblessed reference is fatal. That's what the blessed call is checking.

If you want to eliminate blessed, we need an alternative.

what about this?

ref($version) && eval { $version->can("new") }

The extra eval overhead is annoying, but I think does what we want.

mohawk2 commented 9 years ago

Done. What do you think?

mohawk2 commented 9 years ago

Further to Leon's (apparently now-deleted) comment, I've now changed it (after consulting the UNIVERSAL doc) to:

eval { $version->isa("version") }

dagolden commented 9 years ago

Fixed by #17