more redesign
[p5sagit/Email-Archive.git] / test_run
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Email::Simple;
5 use Email::Simple::Creator;
6
7 use Email::Archive;
8
9 my $email = Email::Simple->create(
10     header => [
11       From    => 'foo@example.com',
12       To      => 'drain@example.com',
13       Subject => 'Message in a bottle',
14       'Message-ID' => 'helloworld',
15     ],
16     body => 'hello there!'
17 );
18
19 my $e = Email::Archive->new();
20 $e->connect('dbi:SQLite:dbname=test.db');
21 print "sending @{[$email->as_string]}\n";
22 $e->store($email);
23
24 my $found = $e->retrieve('helloworld');
25 print $found->as_string;