Re: bash "."?
On Fri, May 15, 2020 at 13:47 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > > >> On 15 May 2020, at 20:08, ToddAndMargo via perl6-users < > perl6-users@perl.org> wrote: > >> > >> On 2020-05-15 10:37, Elizabeth Mattijsen wrote: > >>> There will never be a Perl 6 version. > >> > >> > >> what would you use in place of it? Todd, I haven't kept up with the details of what you really need, but I really like the Raku module Config::TOML for my needs. It might not work if you have to adhere to some other standard, but if you have control it's pretty slick. -Tom
Re: I need help with IO.e
On Mon, May 18, 2020 at 14:36 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 22:28, Paul Procacci wrote: ... > 'say if "test".IO.d', and > 'say "test".IO.d.Bool' Try: 'say so "test".IO.d'
Re: I need help with IO.e
On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-18 13:28, Tom Browder wrote: ... > > Try: > > > > 'say so "test".IO.d' Todd, you didn't try what I suggested. Once again, look a the line above^^ There is no "if" there. -Tom
Re: I need help with IO.e
On Mon, May 18, 2020 at 17:51 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-18 15:44, Tom Browder wrote: > > On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-05-18 13:28, Tom Browder wrote: > > > > ... > > > > > Try: > > > > > > 'say so "test".IO.d' > > > > > > Todd, you didn't try what I suggested. Once again, look a the line > above^^ > > > > There is no "if" there. > > > > -Tom > > > > It was the "if" I was interested in. "if" has to change > a True or "useless text message" into a True or False. Since you don't like to listen to advice I give up. The 'so' I was taught by lizmat (or some other expert) a long time ago does the pretty much the same thing execpt it makes a valid statement, whereas I'm not sure the other way does (hard to read your emails with all the superflous output).
Re: I need help with IO.e
On Tue, May 19, 2020 at 03:44 Richard Hainsworth wrote: > The transcendental abundance of purple in Raku :) Ah, Richard, thanks for a trip down memory lane! In my youth I discovered the joys of science fiction a few years after that piece was published. -Tom
Re: bash "."?
On Fri, May 15, 2020 at 20:38 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-15 17:26, Tom Browder wrote: > > On Fri, May 15, 2020 at 13:47 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: Did you look at Raku modules: Config::INI Config ... Go to modules.raku.org and search for "config". -Tom
Re: I need a GTK pop up with time out
On Wed, Jun 3, 2020 at 20:56 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: ... > Can anyone point me to > an example of a GTK information pop up with a time out > feature? Or similar? Have you looked at the examples in the GTK::Simple repo? Go to modules.raku.org, search on GTK, see link to repo. -Tom
Re: just curious to know
On Sun, Jun 14, 2020 at 10:56 Richard Hainsworth wrote: > Hi Radhakrishnan, > > If 'spreading wings over the information technology field' were to mean > anything other than what is fashionable today, then C still reigns. Richard, excellently said! I would like to see that on our Raku.org site in a prominent place. -Tom
Fwd: delimiters with more than one character? ...
An opportunity for Raku golfers to show off Raku on the Debian users list. Best regards, -Tom -- Forwarded message - From: Albretch Mueller Date: Tue, Jul 14, 2020 at 07:52 Subject: delimiters with more than one character? ... To: Debian Users ML I have a string delimited by two characters: "\|" _S=" 34 + 45 \| abc \| 1 2 3 \| c\|123abc " which then I need to turn into a array looking like: _S_AR=( " 34 + 45 " " abc " " 1 2 3 " " c" "123abc " ) I can't make awk or tr work in the way I need and all examples I have found use only one character. Is it possible to do such things in bash? lbrtchx
Re: Baby steps to create a dataframe structure
On Tue, Jul 21, 2020 at 20:00 Warren Pang wrote: > I have the same feeling. Perl5 has PDL which we have been using for data > analysis. While Raku seems to lack this. > I haven't looked into how it might work, but Raku does have the NativeCall interface as well as Inline::Perl5 which may help. I have had a lot of success with using CPAN's Perl modules with Raku programs. Best regards, -Tom
Re: Baby steps to create a dataframe structure
On Wed, Jul 22, 2020 at 06:51 JJ Merelo wrote: > The Raku wrapper for GSL is ready, specifically all matrix operations, > check it out. It's extremely fast, and could be the foundation for these > data frames. > Depending on your use of the GSL, as I recall the license restricts commercial use. Best regards, -Tom
Re: Any sign of a fix for the 10 second compile time?
On Fri, Jul 31, 2020 at 14:55 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > >> On Fri, Jul 31, 2020, 04:45 ToddAndMargo via perl6-users > >> mailto:perl6-users@perl.org>> wrote: Todd, a couple of questions: 1. In your modules that change all the time, do have "use lib ...;" statements in any of them? 2. If the answer to 1. is true, did you know you can use zef to install your own, non-published modules and then remove "use lib...;" statements from your modules and your programs? -Tom
Re: Any sign of a fix for the 10 second compile time?
On Fri, Jul 31, 2020 at 5:38 PM ToddAndMargo via perl6-users wrote: > >> Todd, a couple of questions: > >> 1. In your modules that change all the time, do have "use lib ...;" > >> statements in any of them? > > > > No. If I do, they crash > > # use lib '/home/linuxutil/p6lib'; # may not be precompiled; calling > program must take care of this Just for "-O fun", set up your modules as if they were to be public, i.e., add a META6.jso for the module collection. The collection being "/path/to/MyModules" and in MyModules create: META6.json # create it and add all your modules in it just like you were going to publish the whole mess. ./lib/ # my modules as moved or duped from "/home/linuxutil/p6lib" t/ 00-meta-test.t # some basic test to check your META6.json file Then, in dir "/path/to/MyModules" try: $ zef install . # <== that's a DOT/PERIOD, i.e., the current directory If that works, then you should be able to "use" them from your program. -Tom
Re: Any sign of a fix for the 10 second compile time?
On Sat, Aug 1, 2020 at 12:30 Richard Hainsworth wrote: > What you are asking for is not a bug, but a part of the current stage of > design. It will probably get quicker. Richard, you should find an appropriate place in the docs and add a section on setting up your personal zef repo. Thanks. -Tom
Re: Extended identifiers in named attributes
On Wed, Aug 26, 2020 at 07:31 Marcel Timmerman wrote: I was experimenting with extended identifiers and found that it is > > not possible to use it in named attributes. E.g. > > > sub a (:$x:y) { say $x:y; } > > Are you sure that is supposed to work without some kind of () or <> like a module identifier? But a doc note would be helpful. Best regards, -Tom
Re: Raku User's Survey 2020 out now....
On Thu, Aug 27, 2020 at 20:41 ToddAndMargo via perl6-users wrote: > On 2020-08-27 16:53, Daniel Long Sockwell wrote: > >> Very few of the other [methods are documented] this way. Todd, I have one more suggestion: Why don't you put your "keepers" on Github? Several advantages: 1. easy to change 2. easy to find 3. more eyes on it 4. PRs from interested parties to fix typos or maybe even errors 5. used Markdown format and can easily convert to pdf 6. maybe inspire you to publish your own Raku book -Tom
Re: spurt and array question
On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt( $Leafpadrc, $Line ~ "\n", > :append ); } > Unless I misunderstand, why doesn't this work: my $fh = open $Leafpadrc, :w; $fh.say($_) for @Leafpadrc; -Tom
Re: Help with bug
On Tue, Dec 29, 2020 at 17:16 Elizabeth Mattijsen wrote: > Using an `await` inside a react, feels like a code smell to me. An > `await` will I suggest using 'note' for debugging instead of print or say so info is not delayed and goes straight to stderr. -Tom
Re: Module Documentation
On Tue, Mar 2, 2021 at 08:42 Daniel Sockwell wrote: > Richard Hainsworth wrote: > > My suggestion is that some formal decision is made about documentation > for Raku modules, that some > > documentation good practices are put together and included in the > Modules page. > I agree that's a good idea, but I think it needs to be part of a larger idea of module best practices in general, including testing, and maybe a "green" check as a module that approved as "meets standard" or something like that.
Re: Please create a Raku community channel
On Sat, Mar 13, 2021 at 08:12 Joseph Brenner wrote: > Richard Hainsworth wrote: > > > I found out yesterday by the intervention of a regular participant in > > the community that a new documentation website is being worked on. > > I should say, I was surprised to hear about that project also. I knew > about Richard Hainsworth's work, but not about what the other team was > doing. > Same here, and I have a very vested interest since I contributed a working solution to the pre-documentable doc site that kept the Languag sub-section titles sorted which is very important IMHO for easier browsing.
Re: Module Documentation
On Tue, Mar 16, 2021 at 05:20 Elizabeth Mattijsen wrote: > > On 16 Mar 2021, at 04:22, Matthew Stuckwisch > wrote: > > I'm on board with this. I also use App::Mi6 after I saw from Elizabeth how much it helps with module development (and maintenance!). And from almost the beginning with mi6 I put my README.md source in a docs/README.pod location so the mi6 usage would not interfere with inline pod in my modules (but don't forget to change the dist.ini file accordingly). -Tom
Re: What's going on with "given (junction) {when (value)...}"
On Tue, Jun 1, 2021 at 11:31 William Michels via perl6-users < perl6-users@perl.org> wrote: > Hi Bruce, > This is what I see with Rakudo 2020.10 (all code below performs > delightfully as expected): > This whole thread looks like good stuff for some probably missing roast tests. -Tom
Re: How do a pe-salt an array inside an object?
On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: ... > writing out 2000 skips is not practical. Todd, why don't you tell us what you're really trying to do, i.e., what is your use case? Maybe the experts can suggest a better class design. -Tom
Windows tutorial needed (Todd?)
See https://github.com/Raku/docs issue #3913. -Tom (tbrowder)
Re: Windows tutorial needed (Todd?)
On Sun, Jul 11, 2021 at 14:27 yary wrote: > The link for that issue is https://github.com/Raku/doc/issues/3913 > ("doc" not "docs") > Thanks, @yary, for noticing my FF (finger fumble :-D)!
Re: Windows tutorial needed (Todd?)
On Sun, Jul 11, 2021 at 17:12 ToddAndMargo via perl6-users wrote: > On 7/11/21 2:31 AM, Tom Browder wrote: > > See https://github.com/Raku/docs <https://github.com/Raku/docs> issue #3913. ... > Would you be a little more specific. Are you looking for > an install guide? Or something else? Todd, did you look at the issue in the corrected link submitted by @yary? That pretty much describes (in order of most to least importance) the main things I would like to see in the tutorial/checklist. If not, please look at: <https://github.com/Raku/doc/issues/3913>.
Re: Windows tutorial needed (Todd?)
On Mon, Jul 12, 2021 at 15:44 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: I should be able to help with a few of those. Do I post > it back to the issue and have JJ formalize it? Do you know how to write in Markdown or Raku POD? Did you ever get your Github account? IMHO, you (emphasis on YOU) should try to write a good draft we can comment on, that means it would be best done on your own github account. Then you can use the web interface and edit from any browser. Plus it's easy for other users to peruse and comment on. You have a reputation as the primo Raku Windows user (and Windows professional expert), so you should run your draft up the old github flag pole and we onlookers can suggest fine tuning edits. ;-D -Tom P.S. And JJ can peek in once in awhile if he wants to.
Re: pod questions
On Mon, Jul 19, 2021 at 06:57 Marcel Timmerman wrote: Reading a bit, I came across old documents (with a warning that these are > out of date) https://design.raku.org/S02.html#Multiline_Comments . It > states that any unrecognized format name should be treated as a comment > block, which the above output shows, the renderers do not. Should I file an > issue? > Yes, please. -Tom
Re: pod questions
On Mon, Jul 19, 2021 at 09:20 Marcel Timmerman wrote: > On 7/19/21 2:29 PM, Tom Browder wrote: > > On Mon, Jul 19, 2021 at 06:57 Marcel Timmerman wrote: > > Reading a bit, I came across old documents (with a warning that these are >> out of date) https://design.raku.org/S02.html#Multiline_Comments . It >> states that any unrecognized format name should be treated as a comment >> block, which the above output shows, the renderers do not. Should I file an >> issue? >> > > Yes, please. > > -Tom > > Will do. > > What about the other questions? > Regarding the other questions: 1. I believe there are no reserved words for the '=begin/=end comment'. However, nested comments I believe were an issue at one time but they aren't now. 3. That depends on what you're doing. For example, currently the Raku parser recognizes the nested pod code block, but it cannot handle pod codes inside that pod code block. If you just want to preserve whitespace using one of the two blocks alone should be good enough. -Tom
Re: ftp client yet?
On Tue, Oct 26, 2021 at 00:22 Ralph Mellor wrote: > > This is what the more complicated stuff I am doing. ... And if the code doesn't work because of a newly-found need of a go-between Perl5 and Raku, the author of Inline::Perl5 is very helpful in finding a fix and releasing a new version. Best, -Tom
Re: Windows tutorial needed (Todd?)
On Sat, Nov 6, 2021 at 18:02 ToddAndMargo wrote: > On 7/11/21 02:31, Tom Browder wrote: > > See https://github.com/Raku/docs <https://github.com/Raku/docs> issue > #3913. > > > > -Tom (tbrowder) > > Hi Tom, > > I finally got around to writing your request up. I will > let you look it over, modify as needed, and place in > the proper location. Thanks, Todd, I’ll take a look. This is very timely since I have a captive audience (most likely all Windows ppl) at our local library next Saturday and will be mentioning Raku and Perl. Blessings, -Tom P.S. The doc did make it with your previous email. >
Docs on docs.raku.org need automated build
Doc site i see is several weeks old and missing my last merged contrib on example of programmatic use of ‘require’. Any hope of a rebuild this month? -Tom
Re: Docs on docs.raku.org need automated build
On Mon, Nov 15, 2021 at 12:43 JJ Merelo wrote: > Done also for the official site, https://docs.raku.org > Check it out. > Thank you, JJ--it looks great! -Tom
Re: why not raku ?
On Fri, Nov 19, 2021 at 07:48 Aureliano Guedes wrote: > I am still defending that we need a package for data > analysis/science/engineer (like the Perl5 PDL, Python Pandas or R > data.table) and an IDE for streaming programming like jupyter or rstudio. > Speaking for myself, I agree, and I think there are more than a few of us who would help if some expert took the stick and started such a project. -Tom
Re: why not raku ?
On Mon, Nov 22, 2021 at 12:13 PM Clifton Wood wrote: > Aureliano: > You are correct. That is an effective workaround, but it will be a > maintenance nightmare for large C++ libraries if you have to wrap every > method. > There has to be a better way. Not so easy to find in the docs, but here is a useful module that might be the first place to start helping with: https://github.com/Skarsnik/gptrixie It says support for C++ is planned. -Tom (aka 'tbrowder' on #raku)
Re: file format extensions
On Thu, Dec 30, 2021 at 06:26 Elizabeth Mattijsen wrote: > +1 from me. Shouldn't that be a .rakudoc file ? :-) Or .rakupod?
Re: Implementation of documented POD6 behaviour
On Thu, Dec 30, 2021 at 07:17 Richard Hainsworth wrote: > I plan to use the POD6 metadata functionality a lot in a new module. It > would be far better to separate out the meta data into lines. > Richard, there are many pod things that haven’t been implemented yet. I have planned for a long time to do some more, but I think it’s best to wait until the Rakuast branch is implemented on the master branch. FYI, my early efforts were not as good as they should have been because of my tiny knowledge of the grammar, and I know of many places where things could be improved. Some of those places require, IMHO, a major redo of some pod constructs. Not many folks were interested in pod, but that is changing as Raku is maturing and getting new blood and interest. You should feel free to work on anything that interests you. Happy New Year!
Re: BEGIN {} question
On Mon, Aug 29, 2022 at 10:29 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: ... > Does the compiler make a full pass through > the code before firing off the BEGIN routine NO. And I think you may be surprised how much speedup you may get by using the precompiled-module "trick" for most of your 11,000-line program. -Tom
Re: BEGIN {} question
On Mon, Aug 29, 2022 at 12:31 PM ToddAndMargo via perl6-users wrote: > On 8/29/22 08:41, Tom Browder wrote: ... > > And I think you may be surprised how much speedup you may get by using > > the precompiled-module "trick" for most of your 11,000-line program. ... > Hi Tom, > The .precomp workaround was never in question! > But there are tines when it is impractical. ... > So lots and lots of compiling that .precomp does not > help me with. ... > More information that you wanted. Sorry. No reason to apologize, Todd. I had forgotten how much you were actually doing with your Raku code--a textbook example for sure! But I apologize for my impatient replies. :-) Blessings, -Tom
Re: Marketing / PR / Branding
On Tue, Oct 31, 2023 at 08:41 Fernando Santagata wrote: > Hi Richard, > > Where is the Raku/Problem-solvers discussion about PR? > Ditto
Re: Test not working so well
Try: say so $= On Sat, Dec 9, 2023 at 18:22 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi All, > > What am I doing wrong here? > > > my $x="abc2def"; say $x=/ ^ <[0..9]> ** 7 $ /; > / ^ <[0..9]> ** 7 $ / > > [0] > my $x="abc2def"; say $x=/ ^ <[l..z]> ** 7 $ /; > / ^ <[l..z]> ** 7 $ / > > [0] > my $x="abc2def"; say $x~~/ ^ <[0..9]> ** 7 $ /; > Nil > > [0] > my $x="abc2def"; say $x~~/ ^ <[l..z]> ** 7 $ /; > Nil > > > I am looking for a True or a False. > > Many thanks, > -T >
Re: Help with macports port for zef
On Mon, Nov 27, 2023 at 02:17 raf via perl6-users wrote: > Hi. I'm trying to create a macports portfile for zef so I'm not a Mac user, but I've been struggling with another Rakudo installation method for Linux and had similar problems. My solution has been to install the binary code for linux by downloading it and putting it in /opt. Where are you getting the compiled code? Are you rearranging it in any way before it gets to the final destination? Best regards, -Tom
Perl 6 script beginning lines: 'v6;' required?
I have seen the following beginning lines of Perl programs in some examples on the Perl 6 web site: #!/usr/bin/env perl6 v6; Isn't the 'v6' superflous given the first line? Best regards, -Tom
Re: Perl 6 script beginning lines: 'v6;' required?
On Fri, Mar 13, 2015 at 8:01 AM, Brandon Allbery wrote: > On Fri, Mar 13, 2015 at 8:54 AM, Rob Hoelz wrote: ... Thanks Rob and Brandon. -Tom
Perl 6 Debugging
I am trying to convert a fairly simple Perl 5 program and supporting modules to Perl 6 and making slow progress. Executing 'perl6 -v': This is perl6 version 2015.02-247-gab55cb7 built on MoarVM version 2015.02-25-g3d0404a I am trying to get something equivalent to Carp to show me the exact failure in my code but I haven't found out how yet. At the moment I am executing my program like this: perl6 --ll-exception expecting to see the complete call stack and source code lines, but I don't see my code at all. Here is the result of my last execution: juvat2:test$ test_ellipsoid.pl Unhandled exception: This type cannot unbox to a native integer at :1 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/CORE.setting.moarvm:print_exception:4294967295) from src/gen/m-CORE.setting:13775 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/CORE.setting.moarvm::40) from gen/moar/stage2/NQPHLL.nqp:1381 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/nqp/lib/NQPHLL.moarvm:command_eval:374) from src/Perl6/Compiler.nqp:17 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/nqp/lib/Perl6/Compiler.moarvm:command_eval:93) from gen/moar/stage2/NQPHLL.nqp:1321 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/nqp/lib/NQPHLL.moarvm:command_line:116) from src/gen/m-main.nqp:39 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/perl6.moarvm:MAIN:18) from src/gen/m-main.nqp:35 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/perl6.moarvm::197) from :1 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/perl6.moarvm::8) from :1 (/home/tbrowde/.rakudobrew/moar-nom/install/languages/perl6/runtime/perl6.moarvm::9) Can anyone point me in the right direction? Thanks. -Tom
Re: Perl 6 Debugging
On Sat, Mar 14, 2015 at 5:25 PM, Elizabeth Mattijsen wrote: >> On 14 Mar 2015, at 23:19, Tom Browder wrote: ... > Could you post the code of test_ellipsoid.pl for others to see (e.g. on > gist.github.com)? That would help in tracing the problem (which is causing > you to not be informed of where the code has gone wrong). I'm happy to, but I'm a little embarrassed for you to see how little progress I've made since I've been working one statement or so at a time expecting a detailed error traceback. Nevertheless, it's here: https://gist.github.com/08e881d7f1c7a7072dc9.git I don't expect anything more than: 1. The offending statement. 2. A pointer to perl 6 debugging. Thanks! Best, -Tom
Re: Perl 6 Debugging
On Mar 14, 2015 6:46 PM, "yary" wrote: > > For some reason your github link comes up as an empty page when I click on it. I was able to find it here: > > https://gist.github.com/search?q=test_ellipsoid.pl I've never used gist.github.com before and probably murfled it. There should be a single repo with two files (test_ellipsoid.pl and Ellipsoid.pm6). Gist.git seems to take the repo name from the least ordered file name! I tried several times to get it right but I need to do some more reading and try again. -Tom
Re: Perl 6 Debugging
On Mar 15, 2015 1:26 AM, "Moritz Lenz" wrote: > When I run your code with perl6-m (Rakudo with the MoarVM backend), I get > > ===SORRY!=== Error while compiling /home/moritz/Ellipsoid.pm6 > Variable '$class' is not declared > at /home/moritz/Ellipsoid.pm6:154 > --> my( $class⏏, %args ) = @_; ... > Which is because my() (with parens immediately after the 'my') is being > interpreted as a subroutine call, not a declarator. > > Somehow, this still very much looks like Perl 5 code to me :-) I know. As I said, I am embarrassed to show how little progress I've made. > > 2. A pointer to perl 6 debugging. > * use the MoarVM backend :-) Okay... > * For runtime errors, https://github.com/jnthn/rakudo-debugger/ can help > you. > Okay... Thanks so much, Moritz Now I have more tools to move along to my goal. Warmest regards, -Tom
Re: Perl 6 Debugging
On Sat, Mar 14, 2015 at 5:19 PM, Tom Browder wrote: > I am trying to convert a fairly simple Perl 5 program and supporting > modules to Perl 6 and making slow progress. I have made much progress since Moritz showed me how to use perl6-m. Now I have come to a point where I haven't yet found what the problem is or how to fix it. Using perl6-m version: 2015.02-247-gab55cb7 built on MoarVM version 2015.02-25-g3d0404a with the same file ('Ellipsoid.pm) but in its present state I execute: $ perl6-m Ellipsoid.pm and see: ===SORRY!=== Error while compiling Ellipsoid.pm Placeholder variables cannot be used in a method at Ellipsoid.pm:352 --> method� set_custom_ellipsoid make: *** [test-e] Error 1 The file is located here: https://gist.github.com/4f3651c350774e065d3b The initial part of the code for the offending method definition is: method set_custom_ellipsoid { my ($name, $major, $recip) = @_; $name = uc $name; $recip = 0 unless defined $recip; if ($major) { %ellipsoids{$name} = [ $major, $recip ]; } else { croak("set_custom_ellipsoid called without semi-major radius parameter"); } set_ellipsoid($name); } I don't see the problem there. Is it possible the problem is in one of the calls to the method? I looked at all the calls but don't see an obvious problem. Thanks. -Tom
Re: Placeholder Variable (was: Perl 6 Debugging)
On Sun, Mar 15, 2015 at 2:55 PM, Timo Paulssen wrote: ... Thanks, Timo! Subroutine arg handling is an awkward but very exciting improvement for an old but non-expert Perl 5 user. Very briefly, how does one properly translate this to Perl 6: sub foo {my @a = @_; } Best, -Tom
Carp and Croak
How can I replace Carp and Croak in Perl 6? Thanks. Best, -Tom
Re: Carp and Croak
On Sun, Mar 15, 2015 at 8:32 PM, Tom Browder wrote: > How can I replace Carp and Croak in Perl 6? According to TimToady on #perl6, "to be honest, we haven't thought much about carp/croak yet." So I'm using "die" until something better comes along. -Tom
Trig Functions "to-radians" and "from-radians"
Those two functions are documented here: http://design.perl6.org/S32/Numeric.html#Trigonometric_functions but I have tried to use them with no luck: say 10.to-radians(Degrees); Undeclared name: Degrees used at line 9 So how does one use the two functions? Best, -Tom
Re: Trig Functions "to-radians" and "from-radians"
On Tue, Mar 17, 2015 at 1:54 PM, Paul Cochrane wrote: > Hi Tom, > > On Tue, Mar 17, 2015 at 12:52:42PM -0500, Tom Browder wrote: >> Those two functions are documented here: >> >> http://design.perl6.org/S32/Numeric.html#Trigonometric_functions >> >> but I have tried to use them with no luck: >> >> say 10.to-radians(Degrees); >> >> Undeclared name: >> Degrees used at line 9 >> >> So how does one use the two functions? > > it seems that to-radians() is specified, but not yet implemented in Rakudo > (see, for example line 71 in > https://github.com/perl6/roast/blob/master/S32-num/cool-num.t; the test is > skipped for Rakudo). > > BTW: doc.perl6.org is a good resource for documentation of the currently > implemented parts of the spec. The written spec has also come to mean > "speculation" rather than "specification". The specification is basically > the roast test suite at present. Thanks, Paul! -Tom
Object Contruction
My new object needs some methods run during construction. How can I do that without defining my own "new" method? I think something like this is supposed to work: class Geo::Ellipsoid; has $.ellipsoid is rw = 'WGS84'; # this needs more processing whether user-entered or default has $.units is rw = 'radians'; # ... more attributes # I can either us this (or submethod BUILD) # don't really yet understand the difference method BUILDALL { # but how do I get access to the class's attributes to manipulate? self.set_ellipsoid($ellipsoid); # more methods used to initialize... } method set_ellipsoid($ell) { self.ellipsoid = $ell; # process further... } So, the question is: how do I get access to the class attributes and methods inside BUILDALL (or BUILD)? Do I have to explicitly pass values in its arg signature, including $self? Many thanks. Best regards, -Tom
Re: Object Contruction
On Wed, Mar 18, 2015 at 7:22 AM, Moritz Lenz wrote: ... > http://doc.perl6.org/language/objects#Object_Construction lists at least two > possible ways. Probably the most interesting one is BUILDALL with a > callsame; see the last example (or example skeleton) in that section. Thanks, Moritz, I read that but it's a bit confusing to me. I'll experiment with it some more and hopefully have some more specific questions. Best, -Tom
Re: Object Contruction
On Wed, Mar 18, 2015 at 11:32 AM, Tom Browder wrote: > On Wed, Mar 18, 2015 at 7:22 AM, Moritz Lenz wrote: > ... >> http://doc.perl6.org/language/objects#Object_Construction lists at least two >> possible ways. Probably the most interesting one is BUILDALL with a >> callsame; see the last example (or example skeleton) in that section. For my purposes I think the BUILD is best. The BUILDALL method seems to put me in limbo as far as the constructed object and using self. I made a simple class and a driver Perl script: $ cat T.pm <
Re: Object Contruction
You are correct, Liz, but I was trying those pieces to demonstrate to myself that all was available to me in the methods and all worked as I expected. It demos very roughly what I think I have to do to translate Geo::Ellipsoid to Perl 6. It's a WIP and I'm learning Perl 6 as I go. The prog is a toy and not otherwise useful. Thanks. BTW, will you or any other Perl 6 people be presenting at YAPC::NC? I don't see a speaking line-up yet. Best, -Tom
Re: Object Contruction
On Mar 18, 2015 5:25 PM, "Elizabeth Mattijsen" wrote: > YAPC::NC ?? You mean YAPC::NA? Yes, my fingers don't seem to work very well! > I will be there, Good, meeting Perl 6 devs is the only reason I think I might attend. > but haven’t had any inspiration for a presentation just yet. Do you know of any Perl 6 topics to be presented? Best, -Tom ople that might be presenting?
Can a class have an attribute and a method with the same name?
I have a class with an attribute and a method with the same name and it looks so far like they clash. If that should be possible (which I suspect is true), I'll continue to debug. Thanks. -Tom
Re: Can a class have an attribute and a method with the same name?
On Mar 19, 2015 3:02 AM, "Moritz Lenz" wrote: > On 03/19/2015 12:40 AM, Tom Browder wrote: > So, you can have an attribute $!x and a method x, but if you write > > class A { > has $.x; > method x() {... } > } > > then the method will prevent the automatic accessor from being generated. That looks like the "clash" I'm seeing: A.x calls the method and not the accessor! Thanks, Moritz. Best regards, -Tom
Passing arrays to subroutines
In Perl 5 I can do this: my @a = (1, 2); my @b = (3); foo(@a,@b); sub foo { my $n = @_; die "Wrong num args: $n" if ($n != 3);} In Perl 6 I think this is correct (or nearly so): sub foo(*@args) { die "Wrong num args: { @args.elems }" if @args.elems != 3;} Questions for Perl 6: foo is now defined as: sub foo($a, $b, $c) { # do something with $a, $b, $c } but I want to call it with a flattened array arg. 1. How can I combine arrays @a and @b into one array? 2. Can I flatten the arrays into elements inside the foo call? If not, what is the best way to pass the array elements to foo? Thanks. Best, -Tom
Re: Passing arrays to subroutines
On Thu, Mar 19, 2015 at 10:15 AM, Moritz Lenz wrote: > On 03/19/2015 04:05 PM, Tom Browder wrote: >> >> In Perl 5 I can do this: ... >> 1. How can I combine arrays @a and @b into one array? > > > generally with the comma operator: > > my @combined = @a, @b; It looks like I can also do this: my @combined = (@a, @b); # use parens (not needed, though) >> 2. Can I flatten the arrays into elements inside the foo call? > foo(|@combined) Hm, it looks like this also works: foo(|@, |@b); My error messages are misleading now because of deeper problems. Sorry for the noise. Cheers! -Tom
Function Signatures: Return Types (replace wantarray?)
I need to replace the Perl 5 'wantarray' and think a multi method with differing return types should do it. So I've tried this: multi method foo($a, $b --> {Num,Num}) { #... } multi method foo($a, $b --> Num) { #... } and get errors like: Missing block at Ellipsoid.pm:672 --> ethod to($lat1, $lon1, $lat2, $lon2 --> �{Rat, Rat}) from test_ellipsoid.pl:12 I've tried parentheses, square brackets, and no grouping characters instead of curly braces but that doesn't change the error. Question: How does one properly provide differing function return type signatures? Thanks. Best, -Tom
Re: Function Signatures: Return Types (replace wantarray?)
On Thu, Mar 19, 2015 at 5:58 PM, Tobias Leich wrote: > The multi dispatcher *only* chooses the multi candidate by matching > arguments to parameters. The return type is not considered. Okay, I have now kind of found that in the synopses (which are a bit confusing for me considering the function return type is discussed as part of the function signature). However, you all are correct that I should break the old idioms where it is necessary anyway and this is clearly such a case. Thanks to all who responded: Darren and Tobias. Best regards, -Tom
Need help with: Cannot find method 'postcircumfix:<( )>'...
The error message is: Cannot find method 'postcircumfix:<( )>' in method _normalize_output at /usr/local/people/tbrowde/mydata/tbrowde-home-bzr/perl6/my-perl6-repos/Geo-Ellipsoid/test/../lib/Geo/Ellipsoid.pm:995 in method to at /usr/local/people/tbrowde/mydata/tbrowde-home-bzr/perl6/my-perl6-repos/Geo-Ellipsoid/test/../lib/Geo/Ellipsoid.pm:678 in sub print_dist at test_ellipsoid.pl:181 in sub MAIN at test_ellipsoid.pl:69 in block at test_ellipsoid.pl:25 Line 995 is in this method: method !_normalize_output(*@args) { my @a = @args; my $elem = shift @a; # 'bearing' or 'longitude' # adjust remaining input values by reference for (@a) <-> $_ { # <-> is 'read-write' operator if (self.$elem) { # <=== LINE 995 === LINE 995 # normalize to range [-pi,pi) while ($_ < -(pi)) { $_ += $twopi } while ($_ >= pi) { $_ -= $twopi } } else { # normalize to range [0,2*pi) while ($_ < 0) { $_ += $twopi } while ($_ >= $twopi) { $_ -= $twopi } } $_ = self!rad2deg($_) if self.units eq 'degrees'; } return @a; } Any hints would be appreciated. Best regards, -Tom
Re: Need help with: Cannot find method 'postcircumfix:<( )>'...
On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote: > On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder wrote: >> >> if (self.$elem) { # <=== LINE 995 === LINE 995 > This is an indirect method call. Is that really what you intended? No, it's supposed to be the value of the self attribute whose name is the value of my $elem. I have to go back and see how to do that. Good pointer, Brandon. Thanks! Best, -Tom
Re: Need help with: Cannot find method 'postcircumfix:<( )>'...
On Mar 19, 2015 9:30 PM, "Brandon Allbery" wrote: > > On Thu, Mar 19, 2015 at 10:26 PM, Tom Browder wrote: >> >> On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote: >> > On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder wrote: >> >> >> >> if (self.$elem) { # <=== LINE 995 === LINE 995 >> > This is an indirect method call. Is that really what you intended? >> >> No, it's supposed to be the value of the self attribute whose name is the value of my $elem. I have to go back and see how to do that. > > Unless there is more that you didn't show, that function is not a method and has no `self`. Why do you say that is not a method? The first line says iAs I mentioned, if you *do* have an object reference `self` in scope somehow and want to access a `has $elem` defined within it, you use the automatically generated accessor `self.elem`. (If it was declared private, that is `has $!elem`, then I don't think you can get to it within that function unless it was passed in as a parameter.) > > > -- > brandon s allbery kf8nh sine nomine associates > allber...@gmail.com ballb...@sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Re: Need help with: Cannot find method 'postcircumfix:<( )>'...
On Mar 19, 2015 9:30 PM, "Brandon Allbery" wrote: > Unless there is more that you didn't show, that function is not a method and has no `self`. [Please ignore last msg sent prematurely.] Why do you say that? The first line says it is a private method. -Tom
Re: Need help with: Cannot find method 'postcircumfix:<( )>'...
Thanks for pointing out the error and the best practice comment. When I get the method to do what I really want I will post the solution. Best, -Tom
Re: Need help with: Cannot find method 'postcircumfix:<( )>'...
On Thu, Mar 19, 2015 at 9:26 PM, Tom Browder wrote: > On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote: >> On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder >> wrote: >>> >>> if (self.$elem) { # <=== LINE 995 === LINE 995 >> This is an indirect method call. Is that really what you intended? This is what I'm trying to achieve: > No, it's supposed to be the value of the self attribute whose name is the > value of my $elem. I have to go back and see how to do that. And this seems to work, new line 995 (my only change in the method): >>> if (self.{$elem}) { # <=== LINE 995 === LINE 995 Best, -Tom
Object Introspection for Existence of Methods: How?
I am trying to create a testing subroutine to detect if a class object has a certain method. I want it to look something like this: my $obj = Foo.new(); can_ok($obj, 'method1'); sub can_ok($obj, Str $method_name) { if $obj.{$method_name}:exists { say "ok"; return True; } else { say "not ok"; return False; } } A similar function can detect valid attributes, but this or variants I've tried don't. How can I test for the existence of a method? Thanks. Cheers! -Tom
Re: Object Introspection for Existence of Methods: How?
On Mar 20, 2015 1:50 PM, "Will Coleda" wrote: > class bar { method foo () {}} > my bar $a = bar.new(); > say so $a.can("foo"); Great! > I'm not sure this warrants a new _ok method. How would you do it with an existing test? Thanks, Will. Cheers! -Tom
Re: Object Introspection for Existence of Methods: How?
On Mar 20, 2015 1:51 PM, "Tobias Leich" wrote: > if $obj.^can($method_name) {... Thanks, Tobias. Cheers! -Tom
Re: Object Introspection for Existence of Methods: How?
On Mar 20, 2015 2:07 PM, "Will Coleda" wrote: > > > use Test; > > class bar { method foo () {}} > > ok bar.can("foo"), "stuff"; > ok 1 - stuff Oops (I say as I slap my forehead)! Thanks, Will. -Tom
Writing New Modules for Submission
The guidance for the directory layout for a proposed module is very clear for mandatory items, and two other directories are also mentioned: bin and doc. What about other items such as a Makefile for developer use, development test scripts and modules, and miscellaneous files found in CPAN Perl 5 modules such as TODO, Changes, and MANIFEST? Should they be removed, or maybe moved to a directory hidden from the module ecosystem? Thanks. -Tom
Re: Object Introspection for Existence of Methods: How?
On Fri, Mar 20, 2015 at 2:02 PM, Tom Browder wrote: > On Mar 20, 2015 1:51 PM, "Tobias Leich" wrote: >> if $obj.^can($method_name) {... That doesn't seem to work with private methods. Any trick to accomplish that? -Tom
Re: Object Introspection for Existence of Methods: How?
On Sun, Mar 22, 2015 at 6:22 PM, Henk van Oers wrote: > On Sun, 22 Mar 2015, Tom Browder wrote: >> On Fri, Mar 20, 2015 at 2:02 PM, Tom Browder >> wrote: >>> On Mar 20, 2015 1:51 PM, "Tobias Leich" wrote: >>>> if $obj.^can($method_name) {... >> That doesn't seem to work with private methods. Any trick to accomplish >> that? > What part of 'private' did you mis? > If you write private methods you do not need introspection. I'm trying to write a test. -Tom
Re: Object Introspection for Existence of Methods: How?
On Sun, Mar 22, 2015 at 7:13 PM, Henk van Oers wrote: > On Sun, 22 Mar 2015, Tom Browder wrote: >> I'm trying to write a test. > To test what? Your own typo's? The tests are for a public Perl 6 module translated from an existing Perl 5 module. Do Perl 6 modules not need tests? If so, which ones do they need? and which can be left off? -Tom
Re: Object Introspection for Existence of Methods: How?
On Sun, Mar 22, 2015 at 7:48 PM, Henk van Oers wrote: > On Sun, 22 Mar 2015, Tom Browder wrote: >> Do Perl 6 modules not need tests? > Yes they need tests. >> If so, which ones do they need? > The public interface. >> and which can be left off? > The private stuff. > You can not test for 'random_name'. > This is not about Perl. It's OO-programming. Okay, Henk. Thanks. Best, -Tom
Re: Object Introspection for Existence of Methods: How?
On Mar 23, 2015 3:19 AM, "Moritz Lenz" wrote: > That said, I wonder why tests need introspection at all. I mean, you test by > doing example calls and comparing to expected example return values. No argument from me. I am at the point of trying to replicate, in Perl 6, somene else's test suite (done for a Perl 5 class) and I have not, in general, been questioning the need for each test. And I must admit I may have gone overboard doing some things just because they can be done in Perl 6 and seem to be in the spirit of the original author's intent. >From your and Henk's comments, I think I need to learn a lot more about testing in general. Thanks. Best, -Tom
Re: Object Introspection for Existence of Methods: How?
On Mon, Mar 23, 2015 at 7:04 AM, Tom Browder wrote: > From your and Henk's comments, I think I need to learn a lot more about > testing in general. Any recommendations for books on the subject? -Tom
Re: Object Introspection for Existence of Methods: How?
On Mon, Mar 23, 2015 at 10:41 AM, Elizabeth Mattijsen wrote: >> On 23 Mar 2015, at 14:11, Tom Browder wrote: >> Any recommendations for books on the subject? > > Perl Testing - A Developer’s notebook: Thanks, Liz--getting it! -Tom
Re: Object Introspection for Existence of Methods: How?
On Mon, Mar 23, 2015 at 11:28 AM, B. Estrade wrote: > As good as this book is, it's still Perl 5 specific. So watch out if you're > coming from Perl 5 land and Heaven forbid you're looking to do traditional > things, you might get scolded for asking a reasonable question. o_O. Roger! Thanks, Brett. -Tom
Re: Object Introspection for Existence of Methods: How?
On Mon, Mar 23, 2015 at 9:35 AM, Bruce Gray wrote: >> Any recommendations for books on the subject? > http://shop.oreilly.com/product/9780596100926.do > Perl Testing: A Developer's Notebook > by Ian Langworth and Chromatic > > From 2005, but still a fantastic primer on testing in Perl. Thanks, Bruce. -Tom
Re: Object Introspection for Existence of Methods: How?
On Mon, Mar 23, 2015 at 5:25 PM, Henk van Oers wrote: >>> From 2005, but still a fantastic primer on testing in Perl. > Sorry Tom. > I think you must read a book about OO. I will go back and review OO, Henk. Thanks. Best, -Tom
Re-installation of Perl 6 (Rakudo Star) via rakudobrew on Linux
I installed the 2015.02 version of Perl 6 (Rakudo Star) by following these instructions on the perl6.org site: To install Rakudo and Panda using rakudobrew: rakudobrew build moar rakudobrew build-panda Finally, install Task::Star. This will install all the modules that are shipped with the Rakudo Star Perl 6 distribution: panda install Task::Star Since I saw no words regarding installation of a new version I blindly repeated the instructions above, and I see my perl6 is indeed updated to 2015.03. However, I got this error message during the last step (panda install task::Star) for the last module (LWP::Simple): ==> Fetching LWP::Simple ==> Building LWP::Simple Compiling lib/LWP/Simple.pm to mbc ==> Testing LWP::Simple t/000-load-module.t . ok t/basic-auth.t .. ok t/custom-headers-and-content.t .. ok t/get-binary-camelia.t .. ok t/get-chunked-6guts.t ... ok t/get-perl6-org.t ... ok t/get-unsized.t . ok t/get-w3-latin1-utf8.t .. ok t/get-w3-redirect.t . ok t/getstore.t ok t/parse-url.t ... ok Failed to connect: connection timed out in method initialize at src/gen/m-CORE.setting:24980 in method new at src/gen/m-CORE.setting:24964 in block at t/socket-sanity.t:6 t/socket-sanity.t ... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 2/2 subtests t/stringify-headers.t ... ok Test Summary Report --- t/socket-sanity.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 2 tests but ran 0. Files=13, Tests=53, 79 wallclock secs ( 0.05 usr 0.02 sys + 10.71 cusr 0.95 csys = 11.73 CPU) Result: FAIL test stage failed for LWP::Simple: Tests failed in method install at lib/Panda.pm:125 in block at lib/Panda.pm:1 in method resolve at lib/Panda.pm:185 in sub MAIN at /home/tbrowde/.rakudobrew/bin/../moar-nom/install/languages/perl6/site/bin/panda:20 in sub MAIN at /home/tbrowde/.rakudobrew/bin/../moar-nom/install/languages/perl6/site/bin/panda:18 in block at /home/tbrowde/.rakudobrew/bin/../moar-nom/install/languages/perl6/site/bin/panda:77 Failure Summary Task::Star *test stage failed for LWP::Simple: Tests failed Questions: 1. Is there a better or proper way to upgrade to a new Rakudo Star release? 2. Is the failure of LWP::Simple a bug or just some weird misconfiguration on my system? Thanks. Cheers! -Tom
Re: Re-installation of Perl 6 (Rakudo Star) via rakudobrew on Linux
On Tue, Mar 24, 2015 at 10:44 AM, Steve Mynott wrote: > The easiest thing is to delete everything and start again. Well, one reason to delete and start over is this time panda had changed paths so I was using the old panda. But now, even with the new panda, I still get the failed tests for LWP::Simple. I guess a bug report is in order. Maybe I'll ask on #perl6. Best, -Tom
Re: Re-installation of Perl 6 (Rakudo Star) via rakudobrew on Linux
On Tue, Mar 24, 2015 at 12:10 PM, Tom Browder wrote: > I guess a bug report is in order. Maybe I'll ask on #perl6. A bug report is in order because I didn't get that failure with the previous version. -Tom
How to get indirect access to a class attribute?
Given a class like: our %attrs = (age=>1,wgt=>2); class foo { has $.age = rw;} method a { for %attrs.kv -> $k, $v { my $aval = self."$k"(); # supposed to work for a method name say "attr { $k } has value '{ $aval }'"; } } Question: 1. How can I indirectly refer to the attributes in a method? The above doesn't work (with or without the '()'). 2. Do I have to write a custom accessor to do so? Thanks. Best regards, -Tom
Re: How to get indirect access to a class attribute?
On Wed, Mar 25, 2015 at 8:29 AM, Moritz Lenz wrote: > the indirect method call syntax is the right approach, you just got too > many other details wrong to make it work. Fair enough--my fingers fumbled a few important things. I'll correct and recheck; Thanks, Moritz (and Bruce). Cheers! -Tom
Re: How to get indirect access to a class attribute?
On Wed, Mar 25, 2015 at 8:47 AM, Tom Browder wrote: > On Wed, Mar 25, 2015 at 8:29 AM, Moritz Lenz wrote: >> the indirect method call syntax is the right approach, you just got too >> many other details wrong to make it work. This syntax works in a method as you said: self."$elem"() Again I was getting errors that masked the correctness of that syntax--incomplete debugging! Thanks all. Cheers! -Tom > > Fair enough--my fingers fumbled a few important things. I'll correct > and recheck; > > Thanks, Moritz (and Bruce). > > Cheers! > > -Tom
Can a user "cheat" and call a class's private method?
I need to test some private routines, so is there a way to do that? Or will I have to copy code to a test script or? BTW, the tests are for input/output checks during development--not for the public user. Thanks. Best, -Tom
Re: Can a user "cheat" and call a class's private method?
On Mar 26, 2015 11:04 AM, "Moritz Lenz" wrote: > On 26.03.2015 16:55, Tom Browder wrote: > > I need to test some private routines, so is there a way to do that ... > And then you can also do something like: > > my $private_method = $obj.^private_method_table{$methodname}; > $obj.$private_metnod(arguments here) That works great! > but it is rather questionable use of the MOP. Nevertheless, it is very helpful for debugging. Thanks. Cheers! -Tom
Re: Can a user "cheat" and call a class's private method?
On Fri, Mar 27, 2015 at 6:36 AM, Carl Mäsak wrote: > This feels like the same conversation we had earlier this week about > accessing private methods. :) But maybe there are still a few new > points that can be made. ... Okay, Carl, I think I understand. But what about this for my particular situation (this sounds like your method A I believe): Use a separate module (but included with the code for the whole package) for the non-class-specific, formerly-private methods to be "public", but the use statement for the modules would be inside the class-specific methods that need them (a new, restricted scoping in Perl 6 I understand). That actually makes more sense to me now because some of the private methods are really general math subroutines. That way I can test those subroutines without breaking OOP (I think). Best, -Tom
Example module and its use
I'm trying to get the basic syntax down on creating and using a module. I've tried this and get an error: # file 1: Bar.pm module Bar; sub foo($a, $b, $c) is export {} # file 2: doit.pl v6; use lib <.>; use Bar ; my @t = foo(1, 2, 3); # in a shell $ perl6 doit.pl ===SORRY!=== Error while importing from 'Bar': no EXPORT sub, but you provided positional argument in the 'use' statement I've tried to digest the S11 synopsis on compilation units and I don't see any obvious problem. Ideas, please. Thanks. Best regards, -Tom
Re: Example module and its use
On Sat, Mar 28, 2015 at 5:01 AM, Tom Browder wrote: > On Fri, Mar 27, 2015 at 8:27 PM, Nathan Brown wrote: Okay, this works: use Bar :DEFAULT; but this does not: use Bar ; So is S11 in error!! Best, -Tom
Re: Example module and its use
On Fri, Mar 27, 2015 at 8:27 PM, Nathan Brown wrote: > If you put the attribute is export on a sub, then it is part of the :DEFAULT > and :ALL tagsets. That means you can import them by: > > use Bar :DEFAULT; Okay, I'll try that. > http://design.perl6.org/S11.html#Dynamic_exportation states: > > The default EXPORTALL handles symbol exports by removing recognized export > items and tagsets from the argument list, then calls the EXPORT subroutine > in that package (if there is one), passing in the remaining arguments. > > > The bold text is my emphasis. It seems to imply that in perl6 you can only > import by tagsets without implementing an EXPORT subroutine. > > This strikes me as weird because of this example in S11: > > use Sense ; > > but I couldn't find any examples in the spec tests. Am I missing something? My question too. Thanks. -Tom
Fancy sub arg handling: ability to expand error message?
I like the subroutine arg handling in Perl 6. Is there any simple way to attach a short error msg in place of or additive to the default for, say, a missing arg? Thanks. Best, -Tom
Re: Example module and its use
On Mar 28, 2015 6:23 AM, "Paul Cochrane" wrote: > BTW: please don't use the shortcut 'v6;': AFAIU it's been deprecated in > favour of 'use v6;' > Hope this helps a bit. It does, thanks! BTW, I think my fumbling in learning Perl 6 is giving me some ideas for the Coookbook, at least for p6 newbies. I am keeping track of my questions and resullting simple cases to show exactly how to do something with working code--not too advanced but definitely helpful I think. In that vein, the synopses could do a better job of showing real code--maybe that's part of the cookbook I haven't seen yet. Cheers! -Tom