I've narrowed down the issue to this condition: if the package's name is part
something that we already have in core, then this bug (is it a bug?) appears:
No names to clash with core types; everything works:
$ cat Foo.pm6
unit package Bar;
class Ber {}
$ perl6 -I. -MFoo -e 'say Bar::Ber'
(Ber)
Now package, as Op's, clashes with core Pod:: namespace the issue is there:
$ cat Foo.pm6
unit package Pod;
class Ber {}
$ perl6 -I. -MFoo -e 'say Pod::Ber'
Could not find symbol '&Ber'
in block <unit> at -e line 1
And this can be reproduced if we clash with something else, like IO role:
$ cat Foo.pm6
unit package IO;
class Ber {}
$ perl6 -I. -MFoo -e 'say IO::Ber'
Could not find symbol '&Ber'
in block <unit> at -e line 1
On Wed Oct 12 07:07:19 2016, [email protected] wrote:
> Hi,
>
> I wanted to define a class in the 'Pod' package like so (in file
> lib/Pod/Render.pm6)
>
>
> use Pod::To::HTML;
> unit package Pod;
> class Render {
> # ...
> }
>
>
> Then use it
>
> use Pod::Render;
> my Pod::Render $pr .= new;
>
> Throws the exception
>
> ===SORRY!===
> Type 'Pod::Render' is not declared
> at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6:10
> ------> my Pod::Render⏏ $pr .= new;
> Malformed my
> at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6:10
> ------> my Pod::⏏Render $pr .= new;
>
>
> I expect it to instantiate without problems as seen in my other projects.
>
> When the declaration becomes like below, everything goes well.
>
> use Pod::To::HTML;
> class Pod::Render {
>
> }
>
>
> Greetings,
> Marcel
>