--- /dev/null
+^(?!script/|examples/|lib/|inc/|t/.+\.t|t/dist/\w+/(\w+\.PL|lib/\w+\.pm)|Makefile.PL$|README$|MANIFEST$|Changes$|META.yml$)
+.svn
use Moose;
use Email::Archive::Storage::DBI;
+our $VERSION = '0.02';
+
has storage => (
is => 'rw',
does => 'Email::Archive::Storage',
);
1;
+
+
+__END__
+
+=head1 NAME
+
+Email::Archive - write emails to a database, fetch them
+
+=head1 WARNING!
+
+I only uploaded this to get it out there and kick myself into making it more
+useful. As you can see it's not documented or tested yet. I put this together
+mostly in one evening in a coffeeshop. It shows in some ways. caveat programmer.
+
+=head1 LICENSE
+
+This library may be used under the same terms as Perl itself.
+
+=head1 AUTHOR AND COPYRIGHT
+
+Copyright (c) 2010, 2011 Chris Nehren C<apeiron@cpan.org>.
use DBI;
use File::ShareDir 'module_file';
use File::Slurp 'read_file';
-use Email::Simple::Creator;
+use Email::MIME;
use Email::Abstract;
use SQL::Abstract;
use autodie;
my $sth = $self->prepare($sql);
$sth->execute(@bind);
my ($message) = $sth->fetchrow_hashref;
- return Email::Simple->create(
+ return Email::MIME->create(
header => [
From => $message->{from_addr},
To => $message->{to_addr},
#!/usr/bin/perl
use strict;
use warnings;
-use Email::Simple;
-use Email::Simple::Creator;
+use Email::MIME;
+
+use Test::More;
use Email::Archive;
-my $email = Email::Simple->create(
+my $email = Email::MIME->create(
header => [
From => 'foo@example.com',
To => 'drain@example.com',
);
my $e = Email::Archive->new();
-$e->connect('dbi:SQLite:dbname=test.db');
-print "sending @{[$email->as_string]}\n";
+$e->connect('dbi:SQLite:dbname=t/test.db');
$e->store($email);
my $found = $e->retrieve('helloworld');
-print $found->as_string;
+cmp_ok($found->header('subject'), 'eq', "Message in a bottle",
+ "can find stored message by ID");
+
+done_testing;
+unlink 't/test.db';