Skip to content

Instantly share code, notes, and snippets.

@tony-o
Created July 1, 2013 05:43
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 tony-o/5898608 to your computer and use it in GitHub Desktop.
Save tony-o/5898608 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use DBIish;
use Digest::SHA;
use JSON::Tiny;
sub buf_to_hex {
$^buf.list.fmt('%02x', '');
}
try {
print "Content-Type: text/plain\n\n";
my $dbh = DBIish.connect('mysql',
:user(''),
:password(''),
:host('localhost'),
:port(3306),
:database(''),
RaiseError => True,
PrintError => True,
AutoCommit => True);
my $put_user = $dbh.prepare('INSERT INTO user (email, password) VALUES (?, ?)');
say $put_user.errstr; # displays: Any
$put_user.execute( 'some1' , 'password' );
CATCH {
say $!;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment