develooper Front page | perl.perl6.users | Postings from December 2019

Cannot invoke this object (REPR: Null; VMNull)

Thread Next
Paul Procacci
December 14, 2019 22:32
Cannot invoke this object (REPR: Null; VMNull)
Message ID:

I'm perplexed by the error message as stated in the subject.
It's quite possible I'm doing it wrong.
What I'm attempting to do is create an attribute of a class that is a Map
... who's value is known at compile time; hence the CHECK phaser.

To produce the error it requires two source files, as merging the class and
the code that invokes the class doesn't occur in an error:

# File lib/A.pm6
class A {

        has Map $!pre-compiled = CHECK {
       dir("data", test => { $_ eq none('.', '..') and
"data/$_".IO.d })>>.map({
                                .basename => .dir>>.map({
                                        .basename => .dir>>.basename.Set

        method test {

# File: test.pl6
use lib <lib>;
use A;

my A $x .= new;

% ./test.pl6
Cannot invoke this object (REPR: Null; VMNull)
  in block  at xxxx/git-repos/test/lib/Loader.pm6 (Loader) line 31
  in method test at xxxx/git-repos/test/lib/Loader.pm6 (Loader) line 115
  in method load at xxxx/git-repos/lib/Loader.pm6 (Loader) line 132
  in block <unit> at ./test.pl6 line 7

As stated earlier, when I merge the class and the initialization logic into
the same source file and run from there, no error occurs.

Am I doing this wrong?

Paul Procacci


:(){ :|:& };:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About