develooper Front page | perl.perl5.porters | Postings from July 2018

Re: [perl #133357] Time::Piece overloading will not acceptoverloaded objects

Thread Previous | Thread Next
Maurice Aubrey
July 13, 2018 05:06
Re: [perl #133357] Time::Piece overloading will not acceptoverloaded objects
Message ID:
On Thu, Jul 12, 2018 at 9:05 PM Dan Book <> wrote:

> On Thu, Jul 12, 2018 at 11:38 PM Maurice Aubrey <>
> wrote:
>> I have a proof-of-concept here:
>> It's using Scalar::Util, which I'm not sure is okay or not for a core
>> module. But it's still passing all tests and satisfies my use case.
> I don't think we need looks_like_number or reftype here either. reftype
> will violate the encapsulation of an object that's passed, you should only
> check that if it's not blessed (in which case you can just just check if
> ref eq 'ARRAY'). The looks_like_number check shouldn't be necessary
> (looks_like_number has some interesting edge cases), you can just use it as
> a number and depend on appropriate overloading, Perl will emit the
> appropriate warning or error if it doesn't end up being numeric.
> Time::Seconds's overload means we don't need to special case that as you
> correctly fixed.

Thanks. I've been chatting with Samuel on this. Added your comment here:


> -Dan

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About