[MTOS-dev] [movabletype] bchoate, r1510: Optimized constants.
Hirotaka Ogawa
hirotaka.ogawa at gmail.com
Tue Mar 11 21:05:58 PDT 2008
Why don't you use Constant Functions?
http://perldoc.perl.org/perlsub.html#Constant-Functions
On Wed, Mar 12, 2008 at 4:14 AM, <commits at code.sixapart.com> wrote:
>
> Optimized constants.
>
>
> U branches/release-31/lib/MT/Log.pm
>
>
> Modified: branches/release-31/lib/MT/Log.pm
> ===================================================================
> --- branches/release-31/lib/MT/Log.pm 2008-03-11 19:14:22 UTC (rev 1509)
> +++ branches/release-31/lib/MT/Log.pm 2008-03-11 19:14:28 UTC (rev 1510)
> @@ -9,11 +9,12 @@
> use strict;
> use base qw( MT::Object );
>
> -use constant INFO => 1;
> -use constant WARNING => 2;
> -use constant ERROR => 4;
> -use constant SECURITY => 8;
> -use constant DEBUG => 16;
> +# use constant is slow
> +sub INFO { 1 }
> +sub WARNING { 2 }
> +sub ERROR { 4 }
> +sub SECURITY { 8 }
> +sub DEBUG { 16 }
>
> use MT::Blog;
>
>
>
> _______________________________________________
> MTOS-commits mailing list
> MTOS-commits at sixapart.com
> http://www.sixapart.com/mailman/listinfo/mtos-commits
>
--
Hirotaka Ogawa makes no sense.
http://as-is.net/blog/
More information about the MTOS-dev
mailing list