Re: Perl 6 and DBI - copied from dbi-users

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <20150205090925.397641ce@pc09>
On Wed, 04 Feb 2015 20:07:11 -0800, Darren Duncan
<[email protected]> wrote:

> A discussion started on dbi-users which I thought seemed more appropriate to 
> continue on dbi-dev assuming it caries on in the direction of a design 
> discussion.  I have quoted the important parts of each original message below, 
> to get it started. -- Darren Duncan

FWIW I tested perl6 with Inline::Perl5 and perl5's DBI, and it works :)
If not having DBI for perl6 is the *only* reason not to start with
perl6, then start today!

OTOH there are quite a lot of issues yet to be fixed. e.g. Inline::Perl5
does not yet support streams and file handles amongst which are the
invaluable scalar IO types. That is a known issue and work is in
progress right now.

$ cat dbi5.pl
#!/pro/bin/perl

use 5.20.0;
use warnings;

use DBI;

my $dbh = DBI->connect ("dbi:Pg:");

my $sth = $dbh->prepare ("select count (*) from url");
$sth->execute;
$sth->bind_columns (\my $count);
$sth->fetch;
say $count;
$ perl dbi5.pl
491826

$ cat dbi6.pl
#!perl6

use v6;
use Slang::Tuxic;
use Inline::Perl5;

my $p5 = Inline::Perl5.new;

$p5.use ("DBI");

my $dbh = $p5.invoke ("DBI", "connect", "dbi:Pg:");

my $sth = $dbh.prepare ("select count (*) from url");
$sth.execute;
my @count = $sth.fetchrow_array;
@count[0].say;
$ perl6 dbi6.pl
491826

I didn't yet find the correct syntax for bind_columns in Inline::Perl5

> -------- Forwarded Message --------
> Subject: Perl 6 and DBI
> Date: Thu,  5 Feb 2015 00:23:40 -0000
> From: Greg Sabino Mullane <[email protected]>
> To: [email protected]
> 
> As you may have heard, Larry Wall gave a speech recently declaring
> the goal of releasing Perl 6 this year, 2015. Honestly, there
> is little chance of me using Perl 6 until it has a good, working
> DBI. Anyone know the state of things with DBI and Perl6? Is the
> goal still to implement what is basically DBI v2, or perhaps
> someone is working on a simple port of the existing DBI? Is
> a working DBI even on their list of blocker features for a release?
> 
> 
> -------- Forwarded Message --------
> Subject: Re: Perl 6 and DBI
> Date: Wed, 4 Feb 2015 16:28:15 -0800
> From: David E. Wheeler <[email protected]>
> To: Greg Sabino Mullane <[email protected]>
> CC: [email protected]
> 
> This goes for me, too, and many, many other people too, I’ve little doubt.
> 
> 
> -------- Forwarded Message --------
> Subject: Re: Perl 6 and DBI
> Date: Wed, 04 Feb 2015 17:19:54 -0800
> From: Darren Duncan <[email protected]>
> To: David E. Wheeler <[email protected]>, Greg Sabino Mullane 
> <[email protected]>
> CC: [email protected]
> 
> And in that case, there would/should be a discussion about what form this DBI
> for Perl 6 should take.
> 
> Personally I think one of the most important design changes DBI should make is
> that DBI becomes an API spec that drivers/engines must conform to in order to be 
> certifiably compatible.  Part of the API is that user code can query the
> driver/engine to ask, "do you implement DBI" or "do you implement this version
> of the DBI API" etc.
> 
> DBI should not be an actual code layer that applications have to go through in
> order to talk with the driver/engine, as it is now.
> 
> However, there can exist Perl 6 roles or other shared libraries that a
> driver/engine may optionally use to help it implement the API rather than
> rolling its own.
> 
> Think of the kind of revolution that PSGI brought by working this way, just
> defining an API or protocol to conform to, rather than "being" a module that
> everything had to use.  DBI should do the same thing.
> 
> The actual details of the API / common interface are an orthogonal matter.  The
> key thing I'm looking for is no mandatory shared code between engines/drivers.
> 
> I also believe that what I said, the no mandatory shared code, would also work
> just as well in any language, including a major new Perl 5 version.
> 
> 
> -------- Forwarded Message --------
> Subject: 	Re: Perl 6 and DBI
> Date: 	Wed, 4 Feb 2015 21:52:39 -0600
> From: 	David Nicol <[email protected]>
> To: 	Darren Duncan <[email protected]>
> CC: 	David E. Wheeler <[email protected]>, Greg Sabino Mullane
> <[email protected]>, [email protected] <[email protected]>
> 
> Does this mean the floor is open for brainstorming? I'd like to see more
> transparent integration, so p6+dbi would be like pl/sql or pro*C or whatever
> that language Peoplesoft scripts used to be in that I was working with when I
> wrote DBIx::bind_param_inline.
> 
> http://perlbuzz.com/2008/12/database-access-in-perl-6-is-coming-along-nicely.html
> 
> http://www.mail-archive.com/[email protected]/maillist.html
> doesn't have anything new since 2011.


-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.21   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJU0yU8AAoJEAOhR6E+XcCYF9EH/R78X6WYVSiNPm1JwfKhfIW7
dPc5lCZv87oyXLjuxdKEycXR10b4SHXhtNTLREOhOkdL/y1TkiS0IMvoO/SbrZh1
j56P8VZ48IVsgGrZcy5OlD8W4N0TIthlSVDeYCP7vzm8rvz9E0f/VbUzxcu6d1oL
0+yFpe96mT5bk8hG6OyPcweLrwERQGBDe6/lZqtil4fgQc0wAy+QohnhOIHvqofX
LvEvL0qLAWUoCKe7H+FRbBJNivh50ZzFWDClCUQDk0ZFLz3K9FUfCSlse0HB0MQ4
WhA4RodQdRByEBCzi7c+Y7cae/lmPRN51dRoPPsYQqYqI6FKW4BklaJa6sojOFA=
=pE0x
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.