Skip Menu |
Report information
Id: 129109
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: clifton.wood [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Can't programmatically require() module inside phasers (Cannot invoke this object (REPR: Null; VMNull))
Download (untitled) / with headers
text/plain 283b
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.perl.org/Ticket/Display.html?id=129096
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 429b
Can someone move this to the perl6 queue, please. Thanks. On Sat Aug 27 21:24:25 2016, clifton.wood@gmail.com wrote: Show quoted text
> 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.perl.org/Ticket/Display.html?id=129096
Download (untitled) / with headers
text/plain 144b
On Sat Aug 27 21:28:37 2016, clifton.wood@gmail.com wrote: Show quoted text
> Can someone move this to the perl6 queue, please.
Done. -- Father Chrysostomos
Download (untitled) / with headers
text/plain 653b
<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.perl.org/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
Download (untitled) / with headers
text/plain 397b
$ perl6 -e 'my $module-support = BEGIN (try require ::("Test")) !~~ Nil; INIT { if $module-support { require ::("Test"); }; }; say ?$module-support ?? ::("Test").perl !! "Failed to load"' Show quoted text
> 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"' Show quoted text
> Failed to load
Download (untitled) / with headers
text/plain 986b
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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org