Re: modules and constants

2019-12-06 Thread ToddAndMargo via perl6-users
On 2019-12-05 23:39, ToddAndMargo via perl6-users wrote: Hi All, Its there a way, if you import a module that is also imports a bunch of constants into your main program to be used globally? If so, what is the syntax in the module and in the main program? And what happends if there is a name c

Re: modules and constants

2019-12-06 Thread ToddAndMargo via perl6-users
On Fri, 6 Dec 2019 at 09:05, ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2019-12-06 00:01, Tom Blackwood wrote: > Todd, > > AFAIK Perl’s culture is not to use so many constants in actual > programming. :) > > Tom > Is there a w

Re: modules and constants

2019-12-06 Thread Simon Proctor
If you define them in the top level of your module then all your subs have access : constant FOO = 2; sub inc-by-foo( $a ) { $a+FOO; } On Fri, 6 Dec 2019 at 09:05, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-12-06 00:01, Tom Blackwood wrote: > > Todd, > > > > AFAIK P

Re: modules and constants

2019-12-06 Thread ToddAndMargo via perl6-users
On 2019-12-06 00:01, Tom Blackwood wrote: Todd, AFAIK Perl’s culture is not to use so many constants in actual programming. :) Tom Is there a way to make constants universal inside a module, or do I have to declare them inside every sub?

Re: modules and constants

2019-12-06 Thread Tom Blackwood
Todd, AFAIK Perl’s culture is not to use so many constants in actual programming. :) Tom On Fri, Dec 6, 2019 at 3:47 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Its there a way, if you import a module that is also > imports a bunch of constants into your main pr

modules and constants

2019-12-05 Thread ToddAndMargo via perl6-users
Hi All, Its there a way, if you import a module that is also imports a bunch of constants into your main program to be used globally? If so, what is the syntax in the module and in the main program? And what happends if there is a name conflict between the module and main program? Many thanks,