[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] using DATA for testing



On Wed, 11 Aug 1999 12:00:36 -0400 (EDT), Paul Corr wrote:

>I was wondering if there was any way to map one file handle onto another
>for testing. For example, I have a script with 'while (<INPUT>)' where
>INPUT is the result of 'open INPUT, $inputfile;'
>It would be handy to
>change one line mapping INPUT to DATA during testing, rather than
>switching every instance of INPUT to DATA.

Another approach:

	open DATA, $inputfile unless $testing;

Keep the name of the handle as "DATA", but (re-)opening it explicitely
will use the file instead of the appended data.

	Bart.

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org