Skip Menu |

This queue is for tickets about the Win32Console CPAN distribution.

Report information
The Basics
Id: 38
Status: new
Priority: 0/
Queue: Win32Console

People
Owner: Nobody in particular
Requestors: andrew_harton [...] agilent.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Destruction of Win32::Console object prevents future printf
(see attachment)
Path: monger.newsread.com!bad-news.newsread.com!netaxs.com!newsread.com!newsfeed.fast.net!howland.erols.net!enews.sgi.com!sdd.hp.com!agilent.com!not-for-mail From: "Andrew Harton" <andrew_harton@agilent.com> Newsgroups: comp.lang.perl.misc Subject: Win32::Console problem (was Re: Return from subroutine behaving unexpectedly) Date: Tue, 13 Nov 2001 12:20:58 -0000 Organization: Agilent Technologies Lines: 39 Message-ID: <1005654060.252161@cswreg.cos.agilent.com> References: <1005152668.176148@cswreg.cos.agilent.com> <u9hes3pxcp.fsf@wcl-l.bham.ac.uk> <1005557719.530083@cswreg.cos.agilent.com> <9so5m6$mng$01$1@news.t-online.com> NNTP-Posting-Host: cswreg.cos.agilent.com X-Trace: cswtrans.cos.agilent.com 1005654060 18512 130.29.154.45 (13 Nov 2001 12:21:00 GMT) X-Complaints-To: usenet@cswtrans.cos.agilent.com NNTP-Posting-Date: Tue, 13 Nov 2001 12:21:00 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Cache-Post-Path: cswreg.cos.agilent.com!unknown@dhcp-dub-123.ireland.agilent.com X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) Xref: bad-news.newsread.com comp.lang.perl.misc:428526 > Now again: Can you produce a *working* *subset* of your current script > that reproduces the error you had been mentioning? After a lot of fiddling, I have determined that the cause of the error was something completely unrelated to what I first thought it was. Enclosed is a small script that illustrates the problem; #!/usr/bin/perl use strict; use warnings; use Win32::Console; my $thing = Test(); printf "Return is : $thing\n"; # This never gets printed... sub Test { my $OUT = new Win32::Console(STD_OUTPUT_HANDLE); $OUT->Cls(); $OUT->WriteChar("Press a key",1,2); <STDIN>; return 2; } Basically, it seems that if a new console object is created in a subroutine, once the subroutine is exited, it is no longer possible to print to the screen. I have tried using $OUT->Free() at the end of the sub before returning, but that seems to make no difference. I've discovered that program execution continues just fine (I can write to an output filehandle, for example), but there's no screen output. Any pointers would be appreciated. Thanks, Andrew