[MTOS-dev] [movabletype] bchoate, r1522: More constant declaration changes.
Jay Allen
jay at endevver.com
Thu Mar 13 12:10:14 PDT 2008
Can someone point me to a reference explaining why use of a constant
function is more efficient than use of "use constant". I would think
that both would be inlined and equally efficient or at least not so
different as to warrant a full app search/replace.
Thanks.
Jay Allen
On Thu, Mar 13, 2008 at 1:55 PM, <commits at code.sixapart.com> wrote:
>
> More constant declaration changes.
>
> > Modified: branches/release-31/lib/MT/App/CMS.pm
> ===================================================================
> --- branches/release-31/lib/MT/App/CMS.pm 2008-03-13 18:11:39 UTC (rev 1521)
> +++ branches/release-31/lib/MT/App/CMS.pm 2008-03-13 18:55:13 UTC (rev 1522)
> @@ -12,10 +12,10 @@
> use MT::Util qw( format_ts epoch2ts perl_sha1_digest_hex perl_sha1_digest
> remove_html );
>
> -use constant LISTING_DATE_FORMAT => '%b %e, %Y';
> -use constant LISTING_DATETIME_FORMAT => '%b %e, %Y';
> -use constant LISTING_TIMESTAMP_FORMAT => "%Y-%m-%d %I:%M:%S%p";
> -use constant NEW_PHASE => 1;
> +sub LISTING_DATE_FORMAT () { '%b %e, %Y' }
> +sub LISTING_DATETIME_FORMAT () { '%b %e, %Y' }
> +sub LISTING_TIMESTAMP_FORMAT () { "%Y-%m-%d %I:%M:%S%p" }
> +sub NEW_PHASE () { 1 }
More information about the MTOS-dev
mailing list