[Pdx-pm] Even more inline testing

Michael G Schwern schwern at pobox.com
Tue Jun 21 17:19:41 PDT 2005

On Tue, Jun 21, 2005 at 04:43:04PM -0700, Kris Bosland wrote:
> I am having a problem trying to make this work with Test::More.  Is there
> some IO redirection happening there?  I have included an example below.
> BTW, should I call you 'Michal' or 'Schwern'?

Either one.  Though be sure to use proper spelling when you speak.

Also keep in mind that the way Test::Inline's tying code works is a little
odd.  It has to populate the $_STDOUT_ and $_STDERR_ globals.  Its a bit
simpler without that need, as in this code:


Anyhow, the redirect code looks fine but you probably have a hidden syntax

> use vars qw($_MYSTDOUT_);
> $_MYSTDOUT_ = "bar\n";
> my $codestring1 = "print qw{foo\n};\n";

qw{} does not mean what you think it means.  I think you mean qq{}.

> my $result = eval $codestring1;
> $result = eval $codestring2;
> $result = eval $codestring3;

I'll betcha if you check $@ after each of those evals you'll find your

Michael G Schwern     schwern at pobox.com     http://www.pobox.com/~schwern
Don't try the paranormal until you know what's normal.
	-- "Lords and Ladies" by Terry Prachett

More information about the Pdx-pm-list mailing list