Skip to content

Instantly share code, notes, and snippets.

@jar-o
jar-o / ToSql.pm
Created September 26, 2016 23:30
A::Moose::Role::ToSql - convert a moose object into a CREATE TABLE statement, more-or-less
package A::Moose::Role::ToSql;
use Moose::Role;
use JSON;
sub sql_table {
my $self = shift;
my %ok_types = (
Str => 'character varying(255)',
Int => 'integer',

Keybase proof

I hereby claim:

  • I am jar-o on github.
  • I am jarobson (https://keybase.io/jarobson) on keybase.
  • I have a public key whose fingerprint is 5967 9910 54FA A42E B82F 480A CCA6 11BB 4974 1C62

To claim this, I am signing this object:

@jar-o
jar-o / DBIxOut.pm
Last active January 9, 2017 05:03
Want to see the trace leading up to the sql output? Here you go.
=pod
Put this is in the module in which you want to see SQL:
use DBIxOut;
my $dbout = DBIxOut->new();
$dbout->enable_from_rs($resultset);
# OR