Skip to content

Instantly share code, notes, and snippets.

@lucs
Last active November 22, 2017 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucs/43aa5fa13f6866378e8c154a7b45d811 to your computer and use it in GitHub Desktop.
Save lucs/43aa5fa13f6866378e8c154a7b45d811 to your computer and use it in GitHub Desktop.
I added a 'print' line to the 'connect' function in my Perl 5
'perl-5.22.1/lib/site_perl/5.22.1/i686-linux-multi/DBI.pm', like so:
sub connect {
my $class = shift;
my ($dsn, $user, $pass, $attr, $old_driver) = my @orig_args = @_;
print join("--", @_), "\n";
And when I run this Perl 6 program:
use Inline::Perl5;
use DBI:from<Perl5>;
my $dbh = DBI.connect(
'does:not:matter',
'dont_care',
'dont_care',
{ some_attr => 42 }
) or die "Couldn't connect to database: " . DBI.errstr;
it prints:
does:not:matter--dont_care--dont_care--some_attr--42
DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions at -e line 0.
Can't use string ("42") as a HASH ref while "strict refs" in use at /home/perl/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/i686-linux-multi/DBI.pm line 607.
What happened to the attribute hash?
Just rebuilt from scratch (2017-11-22):
This is Rakudo version 2017.11-3-g0a24efc32 built on MoarVM version 2017.11
implementing Perl 6.c.
And this version of the module was just installed:
Inline::Perl5:ver<0.29>:auth<github:niner>
Same result with perl 5.26.1.
Using ${ some_attr => 42 } appears to solve this problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment