[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixing Magic Numbers



Hi Rob,


On Wed, May 17, 2017 at 5:48 PM, R. Ransbottom <..hidden..> wrote:
I am ready to start fixing the
P::C::P::ValuesAndExpressions::ProhibitMagicNumbers
criticisms.

Perfect!
 
I propose a LedgerSMB::Magic to hold the constants.

We could be using a http code table from CERT or whomever,
but we seem to be using only 10 or so such codes.

We depend on Plack which itself depends on HTTP::Message. HTTP::Message is in the same distribution as HTTP::Status which contains all the HTTP status codes. So, I think it's "free" for us to add "HTTP::Status" as a dependency as we already (indirectly) depend on that. Feel free to choose that as an option here.
 
So I
suggest we not bother at this time; once we've consolidated
our magic such reworking will be pretty easy.

With HTTP::Status out of the way, there may still be a lot of "factoring out" that's required. We'll deal with that after the initial "factoring out" has taken place. Yup.
 
I propose using the constant pragma as that is already
being used; but would be happy to move to 'Readonly' if
the greater convenience is wanted.

I'd vote to stick to 'use constant': it's in core and thus keeps our dependencies limited.



--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel