Re: Helping Perl 6: a complete dev environment

2016-05-01 Thread Will Coleda
FYI, anything that claims to run parrot code is very out of date at this point.

On Thu, Apr 28, 2016 at 7:52 PM, Jovan Trujillo
 wrote:
> I see Padre has hooks for running Perl 6 and even parrot code. Don't know if 
> Git is built into it yet. Probably easier to get started than using Emacs or 
> spacemacs
>
> Sent from my iPhone
>
>> On Apr 28, 2016, at 3:26 PM, Tom Browder  wrote:
>>
>> Is there a pointer somewhere on how to set up a complete development 
>> environment for Perl 6?  I know how to clone individual pieces but I don't 
>> know how to use the various cloned directories for a complete dev 
>> environment using them.  I assume I can install each piece individually but 
>> maybe there is some magic way to use rakudobrew to do it more easily.
>>
>> I would like to be able to easily test and create pull requests for rakudo 
>> and also the Task::Star modules but haven't yet figured out how to get it 
>> all working in the most effective manner.
>>
>> Thanks.
>>
>> Best regards,
>>
>> -Tom



-- 
Will "Coke" Coleda


Re: Where do I need to put a pm6 file?

2016-05-01 Thread Fernando Santagata
Thanks, I'll try that!
On May 1, 2016 15:31, "Tadeusz Sośnierz"  wrote:

> To expand on why putting the file in a directory doesn't Just Work, and
> why so much magic needs to be there for it to work: loading modules is a
> complicated thing in Perl 6, and long story short, if you want to be able
> to have multiple versions installed and loadable at the same time, you need
> some magic under the hood to compensate for that. This magic is what makes
> installing/precompiling a module you want to have installed more
> complicated than a couple of 'mv's.
>
> If you want to avoid the overhead of panda or other installers (to their
> defense, there are several good reasons why they're so bulky and
> complicated :)), I sometimes use a script based on Module::Toolkit, where
> if you want to "just install the damned thing, nothing else", it's just a
> simple 'mtk install .':
> https://gist.github.com/tadzik/dc5c12cab0dc141167fb850f9ede2117
>
> Hope this helps,
>
> tadzik
> On 01/05/16 15:23, Brock Wilcox wrote:
>
> I recommend putting your module into a 'lib' dir near your script. Then in
> your script add:
>
>   use lib 'lib';
>
> That way you don't have to add the -l param.
> On May 1, 2016 09:21, "Fernando Santagata" 
> wrote:
>
>> Hello,
>>
>> I'm trying to write a module and make a program load and use it.
>> Since this code:
>>
>> perl6 -e 'say $*REPO'
>>
>> outputs:
>>
>> inst#/home/nando/.perl6
>>
>> I thought that putting the .pm6 file in there would be enough. So, since
>> my module is A::B, I put B.pm6 into ~/.perl6/A .
>> But when I run a test program which loads A::B, I receive this error:
>>
>> ===SORRY!===
>> Could not find A::B at line 5 in:
>> /home/nando/.perl6
>> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6/site
>> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6/vendor
>> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6
>> CompUnit::Repository::AbsolutePath<140256602878904>
>> CompUnit::Repository::NQP<140256602876152>
>> CompUnit::Repository::Perl5<140256602873560>
>>
>> If I run the test program this way it works:
>>
>> perl6 -I ~/.perl6 ./test.p6
>>
>> Why is that? Where should I put the module file to be seen automatically,
>> without adding the -I option?
>>
>> As a side note, if I want to precompile the module, as panda does when
>> installing new modules from the repository, where should I put the .moarvm
>> file?
>>
>> Thanks!
>>
>> --
>> Fernando Santagata
>>
>
>


Re: Where do I need to put a pm6 file?

2016-05-01 Thread Tadeusz Sośnierz
Starting from the end: there's no need to use github, panda can install 
stuff just fine from a local directory :)
As for the directory layout, 
https://github.com/rakudo/rakudo/blob/nom/docs/module_management.md is 
probably the best source to learn how it works under the hood.


Hope this helps,

tadzik

On 01/05/16 15:35, Fernando Santagata wrote:


Yes, that works too. But I was just trying to understand how the 
directory layout works.


In particular I was trying to reproduce what panda does, since I 
didn't want to use github.com  just to install a 
test module.

I found no documentation about this, so I tried this mailing list.

On May 1, 2016 15:23, "Brock Wilcox" > wrote:


I recommend putting your module into a 'lib' dir near your script.
Then in your script add:

  use lib 'lib';

That way you don't have to add the -l param.

On May 1, 2016 09:21, "Fernando Santagata"
> wrote:

Hello,

I'm trying to write a module and make a program load and use it.
Since this code:

perl6 -e 'say $*REPO'

outputs:

inst#/home/nando/.perl6

I thought that putting the .pm6 file in there would be enough.
So, since my module is A::B, I put B.pm6 into ~/.perl6/A .
But when I run a test program which loads A::B, I receive this
error:

===SORRY!===
Could not find A::B at line 5 in:
/home/nando/.perl6
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6/site
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6/vendor
/home/nando/.rakudobrew/moar-2016.04/install/share/perl6
CompUnit::Repository::AbsolutePath<140256602878904>
CompUnit::Repository::NQP<140256602876152>
CompUnit::Repository::Perl5<140256602873560>

If I run the test program this way it works:

perl6 -I ~/.perl6 ./test.p6

Why is that? Where should I put the module file to be seen
automatically, without adding the -I option?

As a side note, if I want to precompile the module, as panda
does when installing new modules from the repository, where
should I put the .moarvm file?

Thanks!

-- 
Fernando Santagata






Re: DBIish: Why can't I interpolate variable holding database name?

2016-05-01 Thread James E Keenan

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: DBIish: Why can't I interpolate variable holding database name?

2016-05-01 Thread Brock Wilcox
Right - use parenthesis in colon-pair parameters to get the variable
inside. You could use :database<<$db>> to make it like a double-quoted
string. Or my favorite is to use regular => as in database => $db

--Brock
On May 1, 2016 09:13, "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


Re: Where do I need to put a pm6 file?

2016-05-01 Thread Brock Wilcox
I recommend putting your module into a 'lib' dir near your script. Then in
your script add:

  use lib 'lib';

That way you don't have to add the -l param.
On May 1, 2016 09:21, "Fernando Santagata" 
wrote:

> Hello,
>
> I'm trying to write a module and make a program load and use it.
> Since this code:
>
> perl6 -e 'say $*REPO'
>
> outputs:
>
> inst#/home/nando/.perl6
>
> I thought that putting the .pm6 file in there would be enough. So, since
> my module is A::B, I put B.pm6 into ~/.perl6/A .
> But when I run a test program which loads A::B, I receive this error:
>
> ===SORRY!===
> Could not find A::B at line 5 in:
> /home/nando/.perl6
> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6/site
> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6/vendor
> /home/nando/.rakudobrew/moar-2016.04/install/share/perl6
> CompUnit::Repository::AbsolutePath<140256602878904>
> CompUnit::Repository::NQP<140256602876152>
> CompUnit::Repository::Perl5<140256602873560>
>
> If I run the test program this way it works:
>
> perl6 -I ~/.perl6 ./test.p6
>
> Why is that? Where should I put the module file to be seen automatically,
> without adding the -I option?
>
> As a side note, if I want to precompile the module, as panda does when
> installing new modules from the repository, where should I put the .moarvm
> file?
>
> Thanks!
>
> --
> Fernando Santagata
>