Skip to content

Instantly share code, notes, and snippets.

@nothingmuch
Created March 13, 2009 22: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 nothingmuch/78804 to your computer and use it in GitHub Desktop.
Save nothingmuch/78804 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
use KiokuDB;
use KiokuDB::Backend::DBI;
{
package test;
use Moose;
has 'corpus' => ( isa => 'Str', is => 'rw' );
has 'date' => ( isa => 'Str', is => 'rw' );
has 'content' => ( isa => 'Str', is => 'rw' );
has 'permalink' => ( isa => 'Str', is => 'rw' );
has 'title' => ( isa => 'Str', is => 'rw' );
__PACKAGE__->meta->make_immutable;
}
my $dir = KiokuDB->connect( "dbi:SQLite:dbname=foo", create => 1 );
$| = 1;
my $i = 0;
for ( 1 .. 10 ) {
$dir->txn_do( scope => 1, body => sub {
print ".";
for ( 1 .. 1000 ) {
my $obj = test->new(
permalink => "http://www.enseignementsup-recherche.gouv.fr/",
title => "this is a test",
content => "that's a test too",
corpus => "same here",
date => "2009-02-17T09:31:48+01:00",
);
my $id = $dir->store( $obj );
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment