Skip to content

Instantly share code, notes, and snippets.

@jonathanstowe
Created May 25, 2015 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanstowe/2eb6801204edbd877ef5 to your computer and use it in GitHub Desktop.
Save jonathanstowe/2eb6801204edbd877ef5 to your computer and use it in GitHub Desktop.
Package resolution infelicity
Given:
lib/Pack.pm:
class Pack {
use Pack::Util::Collection;
our $collection;
method debug(Str $f) {
say "foo";
}
method collection {
$collection //= Pack::Util::Collection.new;
}
method bar() {
self.collection.bar();
}
}
And lib/Pack/Util/Collection.pm:
class Pack::Util::Collection {
method bar {
say Pack.WHO;
Pack.debug("foo");
}
}
Then
perl6 -Ilib -e 'use Pack; my $p = Pack.new; $p.bar'
Util => (Util)
Method 'debug' not found for invocant of class 'Pack'
in method bar at /home/jonathan/devel/perl6/packtest/lib/Pack/Util/Collection.pm:4
in method bar at /home/jonathan/devel/perl6/packtest/lib/Pack.pm:14
in block <unit> at -e:1
in any <unit-outer> at -e:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment