I'm not sure what the "system call" has do do with your issue (you don't show any sample code), but maybe the following will give you a different tool to play with:

#!/usr/bin/perl use strict; use warnings; use Test::MockObject; BEGIN { my $mockMIMELite = Test::MockObject->new(); my %params = (To => 'parp', Subject => 'Beep', From => 'Bop'); $mockMIMELite->fake_module( 'MIME::Lite', new => sub {ML_new($mockMIMELite, @_)}, send => sub { }, ); $mockMIMELite->mock(send => \&ML_send); $mockMIMELite->mock(attach => \&ML_attach); } use MIME::Parser; my $msg = MIME::Lite->new( To => 'wibble@wobble', From => 'Bogus email source', Subject => 'Email test', Data => 'Email body', ); $msg->send(); sub ML_new { my ($mock, $class, %params) = @_; $mock->{newParams} = \%params; return $mock; } sub ML_send { my ($self) = @_; my %fields = %{$self->{newParams}}; my @headerKeys = ( (grep {exists $fields{$_}} qw(To From Cc Subject)), (grep {!/^(data|subject|cc|to|from)$/i} sort keys %fields) ); print "--------------8<------------------\n"; print "$_: $self->{newParams}{$_}\n" for grep {defined $self->{newParams}{$_}} @headerKeys; print "Data:\n$self->{newParams}{Data}\n"; print "-------------->8------------------\n\n"; return 1; } sub ML_attach { my ($self, %params) = @_; my %fields = %{$self->{newParams}}; print ".............-8<..................\n"; print "Type: $params{Type}\n"; print "Path: $params{Path}\n"; print "Filename: $params{Filename}\n"; print "Disposition: $params{Disposition}\n"; print ".............-8<..................\n"; return 1; }

Prints:

--------------8<------------------ To: wibble@wobble From: Bogus email source Subject: Email test Data: Email body -------------->8------------------
True laziness is hard work

In reply to Re: Capturing Email During Testing by GrandFather
in thread Capturing Email During Testing by lackita

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.