Skip to content

Instantly share code, notes, and snippets.

@melo
Created October 8, 2009 14:28
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 melo/205064 to your computer and use it in GitHub Desktop.
Save melo/205064 to your computer and use it in GitHub Desktop.
Solving a problem for a user in the Lisbon.pm list
package Main::Result::Contacto;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table('Contacto');
__PACKAGE__->add_columns(qw/ nome /);
__PACKAGE__->set_primary_key('nome');
1;
#!/usr/bin/perl -w
use Main;
use strict;
my $schema = Main->connect("dbi:mysql:dbcontacto.db","root","") || die "KABUM";
#my $schema = Main->connect("dbi:SQLite:dbcontacto.db","root","") || die "KABUM";
my @contactos = (['Miguel']);
$schema->populate('Contacto', [ [qw/nome/], @contactos, ]);
#my @artists = (['Michael Jackson'], ['Eminem']);
#$schema->populate('Contacto', [ [qw/nome/], @artists,]
#);
__END__
sqlite3 dbcontacto.db
create table Contacto ( nome varchar(30) );
package Main;
use base qw/DBIx::Class::Schema/;
__PACKAGE__->load_namespaces;
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment