Re: DBIish: Why can't I interpolate variable holding database name?
On 05/01/2016 09:12 AM, Mathieu Gagnonn wrote: Hello James, You can try :database($db) Look at this http://design.perl6.org/S02.html#Adverbial_Pair_forms I've found it very useful! James E Keenan writes: Yesterday I made my first attempt at using any library in a Perl6 program -- specifically, DBIish. The following succeeded in establishing a connection to a Postgresql database named 'hierarchy' on the same disk as Perl6: # $ cat dbiish_connect.pl6 #!/usr/bin/env perl6 use DBIish; my $dbh = DBIish.connect("Pg", :database); say "Database: connection ", ($dbh.ping ?? "established" !! "not established"); $ perl6 dbiish_connect.pl6 Database: connection established # Since I have several different Postgresql databases on disk, I want to be able to store a DB's name in a variable, then have DBIish.connect interpolate that variable while establishing a connection. I tried: # $ cat dbiish_connect_dynamic.pl6 #!/usr/bin/env perl6 use DBIish; my $db = 'hierarchy'; my $dbh = DBIish.connect("Pg", :database<$db>); say "Database $db: connection ", ($dbh.ping ?? "established" !! "not established"); # But I only got this error output: # $ perl6 dbiish_connect_dynamic.pl6 DBDish::Pg: Can't connect: FATAL: database "$db" does not exist (1) in block at /home/jkeenan/rakudo-star/share/perl6/site/sources/3EA876C6AC912AF3692CEF8EEF5E9033C03F7507 (DBIish) line 41 in any at /home/jkeenan/.perl6/precomp/D7820A4EF6D97B780F45CAC4B50C4E6E59589690.1462056119.68849/3E/3EA876C6AC912AF3692CEF8EEF5E9033C03F7507 line 1 in method connect at /home/jkeenan/rakudo-star/share/perl6/site/sources/C2BC378F86912AB748EF3CF51FBE6E3AE0CFE0EA (DBDish::Pg) line 79 in method connect at /home/jkeenan/rakudo-star/share/perl6/site/sources/3EA876C6AC912AF3692CEF8EEF5E9033C03F7507 (DBIish) line 45 in block at dbiish_connect_dynamic.pl6 line 5 # I also tried: # $ cat dbiish_connect_dynamic_2.pl6 #!/usr/bin/env perl6 use DBIish; my $db = 'hierarchy'; my $dbh = DBIish.connect("Pg", ":database<$db>"); say "Database $db: connection ", ($dbh.ping ?? "established" !! "not established"); # But that gave me a different error: # $ perl6 dbiish_connect_dynamic_2.pl6 Too many positionals passed; expected 2 arguments but got 3 in method connect at /home/jkeenan/rakudo-star/share/perl6/site/sources/3EA876C6AC912AF3692CEF8EEF5E9033C03F7507 (DBIish) line 29 in block at dbiish_connect_dynamic_2.pl6 line 5 # Why does variable interpolation not work here? What part is my doing something wrong? What part is a limitation in the DBIish library? Thank you very much. Jim Keenan Thanks; that worked: # cat dbiish_connect_dynamic_3.pl6 #!/usr/bin/env perl6 use DBIish; my $db = 'hierarchy'; my $dbh = DBIish.connect("Pg", :database($db)); say "Database $db: connection ", ($dbh.ping ?? "established" !! "not established"); $ perl6 dbiish_connect_dynamic_3.pl6 Database hierarchy: connection established #
Re: A practical benchmark shows speed challenges for Perl 6
On 03/30/2016 04:11 PM, yary wrote: On Wed, Mar 30, 2016 at 3:20 PM, Elizabeth Mattijsenwrote: Thanks for your thoughts! I’ve implemented $*DEFAULT-READ-ELEMS in https://github.com/rakudo/rakudo/commit/5bd1e . Of course, all of this is provisional, and open for debate and bikeshedding. Yary, if you feel there's a need for this functionality in Perl *5* as well, please file a bug ticket via perlbug. Thank you very much. Jim Keenan
Re: 'split': differences between Perl5 and Perl6
On 02/27/2016 08:38 PM, Brandon Allbery wrote: [...] is what used to be (?:...), and <[...]> is what used to be [...]. Regexes have changed a *lot*, and you will really need to learn how they work now; just hoping that things work just like perl 5 will not work. My apologies for being a Perl6 beginner.
'split': differences between Perl5 and Perl6
I am trying to understand the differences in the way the 'split' function works between Perl5 and Perl6. Consider this string: # $str = q|This is a string to be split|; # Let's suppose I wish to split this string on the multi-character delimiter string 'tri'. The results are the same in both languages. # # Case 1 $ perl -e 'my ($str, @rv);$str = q|This is a string to be split|; @rv = split(q|tri|, $str); print "<$_>" for @rv; print "\n";' # # Case 2 $ perl6 -e 'my ($str, @rv);$str = q|This is a string to be split|; @rv = split(q|tri|, $str); print "<$_>" for @rv; print "\n";' # Now let's suppose that in Perl5 I wish to split the string on a pattern which is the character class /[tri]/. I get: # # Case 3 $ perl -e 'my ($str, @rv);$str = q|This is a string to be split|; @rv = split(/[tri]/, $str); print "<$_>" for @rv; print "\n";' <><> # The result is a list of strings which do not contain any of 't', 'r' or 'i'. Where two of the delimiters occurred consecutively in the original string, I get an empty string -- except that empty strings at the end of the list are dropped. Now let's run the same code in Perl6: # # Case 4 $ perl6 -e 'my ($str, @rv);$str = q|This is a string to be split|; @rv = split(/[tri]/, $str); print "<$_>" for @rv; print "\n";' # I'm surprised to get exactly the same output I got in both languages when my delimiter was the multi-character string 'tri'. The '[' and ']' characters do not seem to indicate "character class" at all. It's as if '/[...]/' magically turns into 'q|...|'. What am I not grasping here? One more case: When, in Perl6, I surround the brackets with angle brackets, I get somewhat more expected behavior: # # Case 5 $ perl6 -e 'my ($str, @rv);$str = q|This is a string to be split|; @rv = split(/<[tri]>/, $str); print "<$_>" for @rv; print "\n";' <><><><> # I get something very similar to Case 3, which was written in Perl5, viz., a list of strings which do not contain any of 't', 'r' or 'i'. Where two of the delimiters occurred consecutively in the original string, I get an empty string -- including at the end of the original string. So, does that mean that, in Perl6, to split a string on a character class, I have to always indicate (via the angle brackets) that the character class is a list? Thank you very much. Jim Keenan
Re: Confused about rakudobrew and Rakudo Star
On 02/03/2016 10:48 PM, Brandon Allbery wrote: On Wed, Feb 3, 2016 at 10:30 PM, James E Keenan <jk...@verizon.net> wrote: I am evidently confused as to the relationship, if any, between the 'rakudobrew' utility and the Rakudo::Star distribution. In short: rakudobrew is for the folks who want to track the rapid development of Rakudo. Star is for folks who want something stable in order to play with the language, and includes the Task::Star ecosystem. As Star was cut earlier today, it's based on the rakudo that was current earlier today (and still fairly current as there haven't been many commits in the past few hours). It's more or less the difference between a Python or Perl 5 release, and installing either from git HEAD. rakudobrew builds from HEAD; Star is a release, which happens to be close to HEAD at the moment because it was just created. HEAD will keep moving; Star will stay stable for a while (used to be monthly, but they're considering releasing less often now) before the next release. So, to clarify: If I want to get this week's release of Rakudo Star on, say, Linux, I have to download this tarball: http://rakudo.org/downloads/star/rakudo-star-2016.01.tar.gz ... and build from source -- correct? I cannot use rakudobrew for Rakudo Star -- correct? Thank you very much. Jim Keenan
Confused about rakudobrew and Rakudo Star
I am evidently confused as to the relationship, if any, between the 'rakudobrew' utility and the Rakudo::Star distribution. Several weeks ago, when it became apparent that there would be delays in the release of a Rakudo Star distribution with the "Christmas" release in it, I executed the following commands to install Rakudo Perl 6. $ rakudobrew install moar $ rakudobrew install panda $ panda install Task::Star IIRC, I found these instructions at several locations, including this helpful blog post: http://friedo.com/blog/2016/01/exploring-perl-6-up-and-running The results: [$ which perl6 /home/jkeenan/.rakudobrew/bin/perl6 $ perl6 -v This is Rakudo version 2015.12-235-g172a92b built on MoarVM version 2015.12-29-g8079ca5 implementing Perl 6.c. And off I went to learn Perl 6. Today, I saw Tobias Leich's message on this list, "Announce: Rakudo Star Release 2016.01", as well as Coke's blog post here: http://blogs.perl.org/users/coke/2016/02/rakudo-perl-6-compiler---2016011-released.html So, I thought, oh good, now I can upgrade. I repeated the above commands, with mixed results. On the one hand, the first two commands ran without incident. But when I said 'perl6 -v', I got the same Rakudo version as several weeks ago. So it appears I didn't upgrade at all. On the other hand, when I ran 'panda install Task::Star', I got this inelegant output: # $ panda install Task::Star ==> Fetching Task::Star ==> Building Task::Star ==> Testing Task::Star ==> Installing Task::Star Task::Star:ver<*>:auth<>:api<> already installed in block at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/C6FEA515A97C45ED8F92BCF5038BA028C9CE9CC0 line 61 in sub indir at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/5AEF9DA5AE15E5AB5CB2ADB58A455E007FA7839E line 20 in method install at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/C6FEA515A97C45ED8F92BCF5038BA028C9CE9CC0 line 42 in method install at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/9036849E1656E91211D00AB4530B81D29A7D6E82 line 161 in method resolve at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/9036849E1656E91211D00AB4530B81D29A7D6E82 line 234 in sub MAIN at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 18 in block at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 150 Actually thrown at: in method install at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/C6FEA515A97C45ED8F92BCF5038BA028C9CE9CC0 line 44 in method install at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/9036849E1656E91211D00AB4530B81D29A7D6E82 line 161 in method resolve at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/sources/9036849E1656E91211D00AB4530B81D29A7D6E82 line 234 in sub MAIN at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 18 in block at /home/jkeenan/.rakudobrew/moar-nom/install/share/perl6/site/resources/76CD539C815A33F2891D2EF3D6D96B1081567AD1 line 150 # So, I'm confused as to whether I have any version of "Rakudo Star" at all. My guess is that I've actually simply built, via rakudobrew, Perl6 on Moar twice. Is that correct? Thank you very much. Jim Keenan
Re: Needed: Rakudo Star with 6.c Christmas Perl 6 release
On 01/25/2016 08:49 AM, Will Coleda wrote: FYI, http://blogs.perl.org/users/coke/2016/01/perl-6c-christmas-rakudo-star-coming-soon.html We hope to have an R* release out in the next two weeks. Thanks for your patience. Thanks for the update! jimk
Needed: Rakudo Star with 6.c Christmas Perl 6 release
Today, I posted on the ny.pm mailing list an announcement that I will attempt to organize a Perl 6 Beginners study group in New York City. I have been advised that for an introductory-level group, the Rakudo Star release would be the way to go. However, when I went here: http://rakudo.org/how-to-get-rakudo/ ... I read this: "NOTE: the Rakudo Star with 6.c Christmas Perl 6 release is not yet available. Check back soon or try one of the older versions." This is what, back in the day, we used to call a 'bummer'. We have people -- including non-Perl programmers -- excited about Perl 6 -- but we don't have the easy on-ramp. Is there a timeline for the release of a Rakudo Star with 6.c? Thank you very much. Jim Keenan
Re: Parrot Developer Summit Q1 2011 date
On May 4, 2011, at 1:37 AM, Christoph Otto wrote: Hi all, Thanks to those who filled out the doodle to indicate your availability for the next Parrot Developer Summit. The slots with the fewest conflicts were at the same time on different weeks. I've closed the doodle poll and marked Saturday the 14th at 1PM UTC But the dates below suggest that what you really meant was probably: Saturday the 14th at *11PM* (2100) UTC -- right? US Pacific: Saturday 14th, 2PM US NY: Saturday 14th, 5PM Paris: Saturday 14th, 11PM Beijing: Sunday 15, 5AM Sydney: Sunday 15, 7AM