in reply to Re: Checking parameters passed to a third party module during testing (wrap)
in thread Checking parameters passed to a third party module during testing
I thought I had this working earlier today, did something else for a while, then when I came back to it found that the call in the replacement sub is calling itself. The code below demonstrates the problm:
use strict; use warnings; use Test::More tests => 1; my $new; BEGIN { require MIME::Lite; $new = MIME::Lite->can ("new"); undef &MIME::Lite::new; } sub MIME::Lite::new { print "Validating MIME::Lite::new params\n"; #goto $new; #return $new->(@_); return &$new; } ok (checkSub (), 'Match existing path'); sub checkSub { my $msg = MIME::Lite->new ((To => 'to', )); my $result = eval {$msg->send}; }
For my current tests it's not essential that the original code be called so I can simply return a success value. However that will not always be appropriate. Any idea what I am doing wrong?
None of the "return" variants affect the behaviour.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Checking parameters passed to a third party module during testing (wrap)
by ammon (Sexton) on Oct 19, 2006 at 19:14 UTC |