[perl #129856] namespace clashes
On Wed, 12 Oct 2016 07:07:19 -0700, mt1...@gmail.com 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 > This appears to have been fixed. Tests added in roast commit 6e5180e96, so resolving.
[perl #129856] namespace clashes
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 '' in block 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 '' in block at -e line 1 On Wed Oct 12 07:07:19 2016, mt1...@gmail.com 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 >
[perl #129856] namespace clashes
# New Ticket Created by mt1957 # Please include the string: [perl #129856] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=129856 > 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