in reply to Re: Factoring out common code in two methods of a class
in thread Factoring out common code in two methods of a class
Thanks for that. I had wondered about "use constant..." but had it in my head that I would need a constant for each 'field' and been put off by the anticipated verbosity of it. But I had been blinkered about putting them all into one constant.
I guess I'll have to leave off the last two parts which in this application are optional, and add them to PACK_TEMPLATE programatically after the length field ... hmm, that's OK.
And yes, you're right that there is a performance implication on constructing that format string each time. Not a lot, but every little bit hurts...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Factoring out common code in two methods of a class
by BrowserUk (Patriarch) on Aug 06, 2009 at 00:07 UTC | |
Re^3: Factoring out common code in two methods of a class
by metaperl (Curate) on Aug 05, 2009 at 19:42 UTC | |
by BrowserUk (Patriarch) on Aug 05, 2009 at 20:59 UTC | |
Re^3: Factoring out common code in two methods of a class
by Anonymous Monk on Aug 06, 2009 at 00:47 UTC |