Created
March 13, 2009 22:34
-
-
Save nothingmuch/78804 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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