[Israel.pm] Testing problem
Shlomi Fish
shlomif at iglu.org.il
Mon Jan 5 07:20:53 PST 2004
On Monday 05 January 2004 15:09, Thomas Maier wrote:
> Hi all,
> I have method like this:
>
> sub method
> {
> my ($self, at param) = @_;
> $pid = open $fh,"-|","command @param";
> $x = do something with $fh;
> return $x;
> }
>
What I would do is this:
sub myopen
{
my ($self, at param) = @_;
$pid = open $fh, "-|", "command @param";
return ($pid, $fh);
}
sub method
{
my ($self, at param) = @_;
($pid, $fh) = $self->myopen(@param);
# Rest of method
}
And then in the test override myopen with a mock function.
Regards,
Shlomi Fish
--
---------------------------------------------------------------------
Shlomi Fish shlomif at iglu.org.il
Homepage: http://t2.technion.ac.il/~shlomif/
I don't believe in fairies. Oops! A fairy died.
I don't believe in fairies. Oops! Another fairy died.
More information about the Perl
mailing list