Hello Rakuns,

How do i access the declarator block of my object method?

I'm trying to do this, but it's not working:

class A {

    #|( This is just a test with 3 parameters:
    * p1 - parameter 1
    * p2 - parameter 1
    * p2 - parameter 1
    )
    method test($p1, $p2, $p3) {
        say "Invoked: [$p1] [$p2] [$p3]";
    }
}

sub MAIN(*@args) {
    my $a = A.new;
    $a.test(|@args);
    CATCH {
        when X::AdHoc {
            say $a.test.WHY; # TODO: This is wrong :-(
        }
    }
}


$ raku test.raku 1 2
Too few positionals passed; expected 4 arguments but got 1
  in method test at test.raku line 8
  in block  at test.raku line 18
  in any  at test.raku line 16
  in method test at test.raku line 8
  in sub MAIN at test.raku line 15
  in block <unit> at test.raku line 1


Is it possible to do what i want? How can i fix it?

I tried several ways (like trying A::test.WHY; ) and all failed...

Regards,
David Santiago

Reply via email to