The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;

### after: use lib qw(@RT_LIB_PATH@);
use lib qw(/opt/rt4/local/lib /opt/rt4/lib);

package RT::Extension::CommandByMail::Test;
require RT::Test;
our @ISA = 'RT::Test';

sub import {
    my $class = shift;
    my %args  = @_;

    $args{'requires'} ||= [];
    if ( $args{'testing'} ) {
        unshift @{ $args{'requires'} }, 'RT::Extension::CommandByMail';
    } else {
        $args{'testing'} = 'RT::Extension::CommandByMail';
    }

    $class->SUPER::import( %args );
    $class->export_to_level(1);

    require RT::Extension::CommandByMail;
}

sub bootstrap_more_config{
    my $self = shift;
    my $config = shift;
    my $args_ref = shift;

    if ( RT_at_or_newer_than('4.4.0') ){
        print $config "Set( \@MailPlugins, qw(Auth::MailFrom Action::CommandByMail));\n";
    }
    else{
        print $config "Set( \@MailPlugins, qw(Auth::MailFrom Filter::TakeAction));\n";
    }
    return;
}

sub RT_at_or_newer_than{
    my $version = shift;
    my ($my_major, $my_minor, $my_sub) = split(/\./, $version);
    my ($major, $minor, $sub) = split(/\./, $RT::VERSION);
    return ($my_major >= $major
            and $my_minor >= $minor
            and $my_sub >= $sub)
            ? 1 : 0;
}

1;