Dynamic variable @*INC not found

2019-06-17 06:44发布

So I've been trying to get electron working with Perl6 and looks like after all my efforts of hacking things to get them to work, it just doesn't want to do it's thing. I have used the following script (one of the examples from the electron repo on git):

#!/usr/bin/env perl6

use v6;

use Electron;

my $app = Electron::App.instance;
LEAVE {
  $app.destroy if $app.defined;
}

say Electron::Dialog.show-open-dialog.perl;

say Electron::Dialog.show-save-dialog.perl;

say Electron::Dialog.show-message-box.perl;

Electron::Dialog.show-error-box("Text", "Content");

prompt("Press any key to exit");

On Running I get this error:

Dynamic variable @*INC not found
  in submethod initialize at C:\rakudo\share\perl6\site\sources\42D84B59BC3C5A414EA59CC2E3BC466BBAF78CDA line 54
  in method instance at C:\rakudo\share\perl6\site\sources\42D84B59BC3C5A414EA59CC2E3BC466BBAF78CDA line 33
  in block <unit> at test.p6 line 9

Actually thrown at:
  in method throw at C:\rakudo/share/perl6/runtime/CORE.setting.moarvm line 1
  in block  at C:\rakudo\share\perl6\site\sources\42D84B59BC3C5A414EA59CC2E3BC466BBAF78CDA line 55
  in submethod initialize at C:\rakudo\share\perl6\site\sources\42D84B59BC3C5A414EA59CC2E3BC466BBAF78CDA line 48
  in method instance at C:\rakudo\share\perl6\site\sources\42D84B59BC3C5A414EA59CC2E3BC466BBAF78CDA line 33
  in block <unit> at test.p6 line 9

And after looking at the submethod i noticed that this was part of the electron module for perl6 and it seems to not like the use of @*INC within the module.

Has anyone managed to successfully use the electron module with Perl6? Has anyone else come across this error? Is there an easy way around it?

I can probably modify the module to get it to compile and run but I wouldn't know where to start with replacing the @*INC.

1条回答
▲ chillily
2楼-- · 2019-06-17 07:08

$*REPO is the 6.c replacement for @INC in Perl 5

In Perl 5 the @INC variable is a global array of paths to be searched when Perl is looking for modules (analogous to the PATH variable used by many OSes to contain the paths to be searched when that OS is looking for programs).

Until recently Perl 6 had a corresponding @*INC variable.

Having an array for this turned out to be inappropriate for 6.c given concurrent module loading and advanced module selection features introduced by the Perl 6 module repository mechanism.

About a month or two before 6.c a lead dev (Stefan Seifert aka nine) switched module loading to use a chained repo approach via a new $*REPO scalar and obsoleted the include array.

For various reasons they did this without a deprecation period.

Any pre 6.c modules that directly mention @*INC need an update and some haven't yet gotten that update. The Electron module was one such -- until you filed an issue (thanks!) and the module's author responded by fixing it.

I'm not aware of any "official" design or enduser documentation of $*REPO. The best info is probably to be found by asking user nine on the freenode IRC channel #perl6-toolchain (logs; join).

查看更多
登录 后发表回答