develooper Front page | perl.perl5.porters | Postings from February 2018

Re: [perl.git] branch blead updated. v5.27.8-361-g910a6a8be1

Thread Previous
From:
demerphq
Date:
February 23, 2018 16:29
Subject:
Re: [perl.git] branch blead updated. v5.27.8-361-g910a6a8be1
Message ID:
CANgJU+WSHi55uE2mzT8XE3jH0Cdin=MW7QMHQ2mNwus66aZ_Bg@mail.gmail.com
On 23 February 2018 at 14:12, demerphq <demerphq@gmail.com> wrote:
> On 23 Feb 2018 17:31, "Yves Orton" <demerphq@gmail.com> wrote:
>
> +            if ($pack->can("((")) {
> +                # this eval is required, or fail the overload test
> +                # in dist/Carp/t/vivify_stash.t, which is really quite
> weird.
> +                # Even if we never enter this block, the presence of the
> require
> +                # causes the test to fail. This seems like it might be a
> bug
> +                # in require. Needs further investigation - Yves
> +                eval "require overload; 1"
> +                    or return "use overload failed";
> +            }
> +            my $sub = _fetch_sub(overload => 'StrVal');
> +            return $sub ? &$sub($arg) : "$arg";
>          }
>      }
>
>
>
> Can anybody shed any light on why the eval above is required? If you replace
> that line with a simple "require overload;" then even when the if condition
> is false and the require is NOT executed we fail the "didn't load overload"
> test in vivify_stash.t which makes no sense to me.
>
> Why would a require that is not executed have any side effects? Why is the
> eval necessary to avoid those side effects? Is this a bug or have I missed
> something?

Graham Knop explained this on #p5p:

   require overload;

autovivifies the overload namespace at compile time, but

    require "overload.pm";

does not. On the other hand, the latter doesn't respect any .pmc files.

Not sure if I should push a change to

    require "overload.pm";

given the issue with .pmc's, but i have make test running now.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous


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