Skip to content

Commit

Permalink
add is_available method to ME plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Nov 11, 2007
1 parent f7b88cb commit 1d38506
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Email/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Email::Simple;
# use 5.006;
# use warnings;
use strict;
$Email::Abstract::VERSION = '2.133_04';
$Email::Abstract::VERSION = '2.133_05';
use Module::Pluggable
search_path => [__PACKAGE__],
except => 'Email::Abstract::Plugin',
Expand Down
7 changes: 7 additions & 0 deletions lib/Email/Abstract/MIMEEntity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ package Email::Abstract::MIMEEntity;
use Email::Abstract::Plugin;
BEGIN { @Email::Abstract::MIMEEntity::ISA = 'Email::Abstract::MailInternet' };

my $is_avail;
sub is_available {
return $is_avail if defined $is_avail;
eval { require MIME::Entity; 1 };
return $is_avail = $@ ? 0 : 1;
}

sub target { "MIME::Entity" }

sub construct {
Expand Down
2 changes: 1 addition & 1 deletion t/subclass.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SKIP: {
skip "this test requires MIME::Entity", 1
unless eval {
require Email::Abstract::MIMEEntity;
Email::Abstract::MIMEEntity->is_available
Email::Abstract::MIMEEntity->is_available;
};
{ # should always adapt as if it's MIME::Entity, the nearest class
package MultiHopMail;
Expand Down

0 comments on commit 1d38506

Please sign in to comment.