sub add_log { my ($self, $parser, $coderef) = @_; push @{$log_list{refaddr $self}}, [ $parser, $coderef ]; return 1; } #### sub find_message { my ($self, $argref) = @_; # Parse the arguments, and get all the message info. my $msg_info = $self->_parse_args($argref, 1); # The '1' means throw an error if we don't have any info. # Find the message in the first log. if ($log_list{refaddr $self}->[0][0]->find_message_info($msg_info)) { # Do something. return 1; } else { return 0; } } #### my $tracer = Mail::Log::Trace::Postfix->new({log_file => 't/data/log'}); my $object = Mail::Log::Trace::Multiple->new(); $object->add_log( $tracer, sub {} ); my $condition = {to_address => '<0001@example.com>', from_start => 1}; ok($object->find_message($condition) , 'Mail::Log::Trace::Multiple: Find message from "to" field.'); ok($tracer->find_message_info($condition), 'tracer test.');