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

Can't programmatically require() module inside phasers (Cannot invoke this object (REPR: Null; VMNull)) #5621

Open
p6rt opened this issue Aug 28, 2016 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Aug 28, 2016

Migrated from rt.perl.org#129109 (status was 'open')

Searchable as RT129109$

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From clifton.wood@gmail.com

Attempting this from the commandline will trigger this already known issue​:

$ perl6 -Ilib -e 'my @​r; BEGIN { @​r = <Test>; }; INIT { require :​:("$_") for @​r };'

===SORRY!===
Cannot invoke this object (REPR​: Null; VMNull)

See also​:

https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129096

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From clifton.wood@gmail.com

Can someone move this to the perl6 queue, please.

Thanks.

On Sat Aug 27 21​:24​:25 2016, clifton.wood@​gmail.com wrote​:

Attempting this from the commandline will trigger this already known
issue​:

$ perl6 -Ilib -e 'my @​r; BEGIN { @​r = <Test>; }; INIT { require
:​:("$_") for @​r };'

===SORRY!===
Cannot invoke this object (REPR​: Null; VMNull)

See also​:

https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129096

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From [Unknown Contact. See original ticket]

Can someone move this to the perl6 queue, please.

Thanks.

On Sat Aug 27 21​:24​:25 2016, clifton.wood@​gmail.com wrote​:

Attempting this from the commandline will trigger this already known
issue​:

$ perl6 -Ilib -e 'my @​r; BEGIN { @​r = <Test>; }; INIT { require
:​:("$_") for @​r };'

===SORRY!===
Cannot invoke this object (REPR​: Null; VMNull)

See also​:

https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129096

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From @cpansprout

On Sat Aug 27 21​:28​:37 2016, clifton.wood@​gmail.com wrote​:

Can someone move this to the perl6 queue, please.

Done.

--

Father Chrysostomos

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From @masak

<Xliff_> require Color if $colorSupport;
<Xliff_> ==> Cannot invoke this object (REPR​: Null; VMNull)
* Xliff_ pulls hair.
<masak> Xliff_​: if you can golf that, we might have something to rakudobug.
<Xliff_> masak​: Already done.
<Xliff_> https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129109
<masak> reproduced locally.
<masak> $ perl6 -Ilib -e'my $colorSupport = True; require Color if $colorSupport; say "hi"'
<masak> ===SORRY!===
<masak> Cannot invoke this object (REPR​: Null; VMNull)
<Xliff_> I'm now thinking it has nothing to do with phasers and everything to do with programatic require.
* masak adds the case with the `if` statements to that ticket

@p6rt
Copy link
Author

p6rt commented Aug 28, 2016

From @ugexe

$ perl6 -e 'my $module-support = BEGIN (try require :​:("Test")) !~~ Nil; INIT { if $module-support { require :​:("Test"); }; }; say ?$module-support ?? :​:("Test").perl !! "Failed to load"'

Test

$ perl6 -e 'my $module-support = BEGIN (try require :​:("XXX")) !~~ Nil; INIT { if $module-support { require :​:("XXX"); }; }; say ?$module-support ?? :​:("XXX").perl !! "Failed to load"'

Failed to load

@p6rt
Copy link
Author

p6rt commented Nov 20, 2016

From @zostay

I ran into what I believe is this problem while working on some code that loads a Perl 6 CompUnit provided by the end-user. No phasers are involved. I am just running require :​:("...") very late in the program.

I wrote CompUnit​::DynamicLib to help out with what I'm doing. With that library I can include some custom code like this​:

require-from <custom/path/lib>, $class-name;
my $obj = :​:($class-name).new;

However, I started getting "Cannot invoke this object (REPR​: Null; VMNull)". I was able to work around the issue by changing the code inside of CompUnit​::DynamicLib from this​:

require :​:($module-name);

to this​:

# Work-around RT #​129109
# require :​:($module-name);
# TODO Try removing this work-around once the ticket is resolved.
use MONKEY-SEE-NO-EVAL;
EVAL "use $module-name";

That's a slightly ugly work-around to the issue until this gets fixed. I don't know what require is failing to do that EVAL "use..." does, but maybe that provides a hint to the fixer as well.

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

1 participant