Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel::Cover + Data::Dumper::Deparse at compile-time breaks compilation #281

Open
Hugmeir opened this issue Mar 5, 2021 · 1 comment
Open

Comments

@Hugmeir
Copy link

Hugmeir commented Mar 5, 2021

; perl -E 'say $^V'
v5.28.3
;
; perldoc Devel::Cover | grep version | head -n1
    version 1.36
;
; perl min_explode.pl
;
; PERL5OPT='-MDevel::Cover' perl min_explode.pl
Global symbol "$method" requires explicit package name (did you forget to declare "my $method"?) at min_explode.pl line 13.
Execution of min_explode.pl aborted due to compilation errors.
;
; cat min_explode.pl
use strict;
use Data::Dumper;
sub enbug {
    local $Data::Dumper::Deparse = 1;
    Data::Dumper::Dumper( sub{} );
}
sub min {
    my $self = shift;
    my %args = @_;
    my $type;
    my $method;
    BEGIN { enbug() }
    my $str = $method;
    return 0;
}

So when Devel::Cover is in use, and $Data::Dumper::Deparse is true & a Dumper() is done, and Dumper() uses the XS version, it breaks compilation in strange ways.
Really strange ways -- removing any of the variable declarations "fixes" it.

@pjcj
Copy link
Owner

pjcj commented Jun 4, 2022

@haarg I don't think your PR does fix this one - at least it seems not to for me. Using 49bae33 and Perl 5.36.0 I can reproduce the error using tests/deparse_sub as

use strict;
use Data::Dumper;

sub z {
    my %c = %+;
    my $d;
    my $e;
    my $f;
    BEGIN {
        local $Data::Dumper::Deparse = 1;
        Dumper sub {}
    }
    $f
}

and running perl -Mblib -MDevel::Cover tests/deparse_sub
I'm not sure why...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants