[Israel.pm] Testing problem

Thomas Maier Thomas.Maier at monosphere.com
Mon Jan 5 07:46:28 PST 2004


Thanks Shlomi

> -----Original Message-----
> From: Shlomi Fish [mailto:shlomif at iglu.org.il]
> Sent: ב 05 ינואר 2004 17:21
> To: Perl in Israel
> Subject: Re: [Israel.pm] Testing problem
> 
> 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.
> 
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/mailman/listinfo/perl
> 
> YAPC::Israel::2004
> http://www.perl.org.il/YAPC/2004/




More information about the Perl mailing list