Skip Menu |

This queue is for tickets about the SHARYANTO-Utils CPAN distribution.

Report information
The Basics
Id: 94805
Status: resolved
Priority: 0/
Queue: SHARYANTO-Utils

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

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



Subject: inappropriate exposure of internal constants
Extracted from an irc log, names elided to protect the guilty: <@Foo> This makes me sad. http://cpansearch.perl.org/src/SHARYANTO/SHARYANTO-Utils-0.47/lib/SHARYANTO/Scalar/Util.pm <+dipsy> urgh. long url. Try http://tinyurl.com/ok7u5km <@Foo> Nasty enough that those return vals were exposed to perl space, but.. why you do this, module author. <@Bar> Foo: wtf is with those magic numbers? <@Bar> looks like he's exposing some IS_NUMBER_IN_* constants <@Qux> it looks generally useful if it's encapsulated and maintained in Scalar::Util to me <@Bar> it's actually the result of grok_number that is being returned <@Bar> he's just taking advantage of looks_like_number returning that without canonicalizing to a bool, rather than writing an XS component to call grok_number directly <@Bar> well clearly someone needs to patch looks_like_number to return !! ...and then release my *own* library that uses these constants :p Hopefully you get the gist. Please don't abuse internals like this - use a sensible wrapper.
On Wed Apr 16 14:57:33 2014, ETHER wrote: Show quoted text
> > Extracted from an irc log, names elided to protect the guilty: > > <@Foo> This makes me sad. > http://cpansearch.perl.org/src/SHARYANTO/SHARYANTO-Utils- > 0.47/lib/SHARYANTO/Scalar/Util.pm > <+dipsy> urgh. long url. Try http://tinyurl.com/ok7u5km > <@Foo> Nasty enough that those return vals were exposed to perl space, > but.. why you do this, module author. > <@Bar> Foo: wtf is with those magic numbers? > <@Bar> looks like he's exposing some IS_NUMBER_IN_* constants > <@Qux> it looks generally useful if it's encapsulated and maintained > in Scalar::Util to me > <@Bar> it's actually the result of grok_number that is being returned > <@Bar> he's just taking advantage of looks_like_number returning that > without canonicalizing to a bool, rather than writing an XS component > to call grok_number directly > <@Bar> well clearly someone needs to patch looks_like_number to return > !! ...and then release my *own* library that uses these constants :p > > Hopefully you get the gist. Please don't abuse internals like this - > use a sensible wrapper.
I do. But to be more precise, it's looks_like_number() which (accidentally) exposes this constants. I'm just (deliberately) using them :) Currently my XS-fu is weak. I'll probably wait until looks_like_number() is changed and breaks my modules, and then find an alternative. Regards, Steven
BTW, I'm removing this module. Fortunately it never got used. Regards, Steven