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

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

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

> 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.


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