develooper Front page | perl.perl5.porters | Postings from March 2013

use constant; loads utf8 unnecessarily

Thread Next
From:
Brad Gilbert
Date:
March 2, 2013 16:41
Subject:
use constant; loads utf8 unnecessarily
Message ID:
CAD2L-T2etRp10e38fRMUBtEKH1L4em1yzeRr8e=+f-8_3rZV1w@mail.gmail.com
    $ perl-5.16.1 -E 'END{say for keys %INC}'
    feature.pm

    $ perl-5.16.1 -E 'END{say for keys %INC} use constant'
    warnings/register.pm
    utf8_heavy.pl
    vars.pm
    strict.pm
    constant.pm
    unicore/lib/Perl/_PerlIDS.pl
    unicore/Heavy.pl
    warnings.pm
    utf8.pm
    feature.pm


If you comment out `*{chr 256} = \3;` from constant.pm:

    $ perl-5.16.1 -E 'END{say for keys %INC} use constant'
    warnings.pm
    warnings/register.pm
    vars.pm
    strict.pm
    constant.pm
    feature.pm

That line is only used for:

        # Before this makes its way into a dev perl release, we have to do
        # browser-sniffing, as it were....
        *{chr 256} = \3;
        if (exists ${__PACKAGE__."::"}{"\xc4\x80"}) {
            delete ${__PACKAGE__."::"}{"\xc4\x80"};
            *_DOWNGRADE = sub () {1};
        }
        else {
            delete ${__PACKAGE__."::"}{chr 256};
            *_DOWNGRADE = sub () {0};
        }

Is there another (safe) way to determine what value
`_DOWNGRADE` should return?

It is currently set to `0` for me on 5.16.0 & 5.16.1
and set to `1` on 5.14.1


---

If we do something different to set `_DOWNGRADE`
I think we should copy the current logic into a test file.

This was brought to my attention by:

http://blogs.perl.org/users/educated_foo/2013/03/holy-bloat-batman.html

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About