maybe you could wrap Mail::Mailer::new and force the testfile backend:
use strict; use warnings; use Mail::Mailer; package Mail::Mailer; my $basic_new; BEGIN{ $basic_new = *Mail::Mailer::new{CODE}; } sub new($@){ my @args = @_; $args[1] = 'testfile';# override type passed in use Data::Dumper; print Dumper \@args; return $basic_new->(@args); } package main; my $m = Mail::Mailer->new('smtp'); $m->open({To => 'me@here.com'}); print $m "hi\n";
I'm not sure if this would be considered to be a sane way of doing this by the experts. So please comment if I'm suggesting something stupid...
In reply to Re: How to mock Mail::Mailer
by lamprecht
in thread How to mock Mail::Mailer
by SilasTheMonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |