niner / Inline-Perl5

Use Perl 5 code in a Raku program
Artistic License 2.0
95 stars 27 forks source link

Problems with Markdent: "Can't use string as a hash ref" #152

Closed JJ closed 3 years ago

JJ commented 4 years ago

This program:

use Markdent::Handler::CaptureEvents:from<Perl5>;
use Markdent::Parser:from<Perl5>;

my $handler = Markdent::Handler::CaptureEvents.new();

my $parser = Markdent::Parser.new(
    dialect => "GitHub",
    handler => $handler
);

Errors with :

Can't use string ("wrapped-perl5-object") as a HASH ref while "strict refs" in use at /home/jmerelo/perl5/perlbrew/perls/perl-5.30.3/lib/site_perl/5.30.3/Markdent/Parser.pm line 126.

  in method invoke-parent at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/BCB33D644DD230F3DF84812EA6C53F24FE4BA414 (Inline::Perl5) line 832
  in sub many-args at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/D05B283A0B3853A171F242BF3BBECC84E0DA5A31 (Inline::Perl5::ClassHOW) line 381
  in method p5_to_p6_type at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/BCB33D644DD230F3DF84812EA6C53F24FE4BA414 (Inline::Perl5) line 320
  in method unpack_return_values at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/BCB33D644DD230F3DF84812EA6C53F24FE4BA414 (Inline::Perl5) line 404
  in method invoke at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/BCB33D644DD230F3DF84812EA6C53F24FE4BA414 (Inline::Perl5) line 523
  in sub many-args at /home/jmerelo/.rakudobrew/versions/moar-2020.05/install/share/perl6/site/sources/D05B283A0B3853A171F242BF3BBECC84E0DA5A31 (Inline::Perl5::ClassHOW) line 381
  in block <unit> at /home/jmerelo/progs/perl6/raku-recipes-apress/Chapter-14/perl-markdown.p6 line 10

Don't thing trying and put "use strict refs" somewhere would fix it...

MorayJ commented 3 years ago

For me using another module

my $pdf = PDF::EasyPDF.new(${file=>"mypdffile.pdf",x=>mm("$height"),y=>mm("$width")});

Seems to work (so adding $ before hash braces. From link stackoverflow)

Edit: So reading the link more thouroughly, it's in the current doucmentation under Pass a scalar reference to Perl 5 code

niner commented 3 years ago

I cannot reproduce this issue anymore. According to git bisect I fixed it with commit f4473114a296a7ab61e6cfb7e1fe540fe931ec6b