From: Chris Nehren Date: Sat, 26 Jun 2010 01:43:56 +0000 (-0400) Subject: more redesign X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=588540027335bae196e7c8c5c54a5c740b505073;p=p5sagit%2FEmail-Archive.git more redesign --- diff --git a/lib/Email/Archive.pm b/lib/Email/Archive.pm index a27196f..e7f5257 100644 --- a/lib/Email/Archive.pm +++ b/lib/Email/Archive.pm @@ -5,11 +5,11 @@ use Email::Archive::Storage::DBI; has storage => ( is => 'rw', does => 'Email::Archive::Storage', - handles => [qw/ - store - retrieve - search - /], + handles => { + store => 'store', + retrieve => 'retrieve', + connect => 'storage_connect', + }, lazy => 1, default => sub { Email::Archive::Storage::DBI->new } ); diff --git a/lib/Email/Archive/Storage/DBI.pm b/lib/Email/Archive/Storage/DBI.pm index 72546fd..793eeed 100644 --- a/lib/Email/Archive/Storage/DBI.pm +++ b/lib/Email/Archive/Storage/DBI.pm @@ -93,7 +93,7 @@ sub _deployed { } } -sub db_connect { +sub storage_connect { my ($self, $dsn) = @_; $self->dbh(DBI->connect($dsn)); if(!$self->_deployed) { diff --git a/test_run b/test_run index 8385f7f..a8b52ad 100644 --- a/test_run +++ b/test_run @@ -17,7 +17,7 @@ my $email = Email::Simple->create( ); my $e = Email::Archive->new(); -$e->storage->db_connect('dbi:SQLite:dbname=test.db'); +$e->connect('dbi:SQLite:dbname=test.db'); print "sending @{[$email->as_string]}\n"; $e->store($email);