Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Arithmetic bug within Time:Piece?

by Anonymous Monk
on Oct 03, 2015 at 00:17 UTC ( [id://1143692]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Arithmetic bug within Time:Piece?
in thread Arithmetic bug within Time:Piece?

Could someone please enlighten me if this is a (old) problem? I had no problems to store an object in a constant.

I think its probably a unclear statement, as its unlikely MSERGEANT didn't know you could write

sub ONE_WEEK() { return bless ... }

http://backpan.perl.org/authors/id/M/MS/MSERGEANT/ dates the module to 2001

perldeltas doesn't show anything relevant , perlbug neither,

But free has more candidates http://perl5.git.perl.org/perl.git/search/HEAD?pg=7;s=constant;st=free but nothing seems on point, even just looking at old constant.pm shows using references as constants ....

So maybe matt was confused at the time :) I doubt I could compile something before before 5.6.2 to check

Replies are listed 'Best First'.
Re^5: Arithmetic bug within Time:Piece?
by LanX (Saint) on Oct 03, 2015 at 01:55 UTC
    My guess is he wanted to primarily store an integer for seconds into a constant.

    Since one can only bless references this would have complicated to simply get a number in nummeric context. (it's still possible with an overload of "0+" )

    edit

    strange, his code does overloading, including "0+"

    Maybe an old version of his code didn't use constant but this other technique to put a immutable literal into a package variable... like *PI = \3.14159265358979;

    well who knows ... old code ... sigh

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1143692]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2026-02-12 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.