Re: [ID 20020318.003] cannot open STDOUT into in memory variable

2002-03-20 Thread Tels

-BEGIN PGP SIGNED MESSAGE-

Moin,

On 20-Mar-02 Nicholas Clark tried to scribble about:
> On Wed, Mar 20, 2002 at 09:13:11PM +0800, Stas Bekman wrote:
>> Nick Ing-Simmons wrote:
> 
>> > For lexicals like your $stdout it is a glob ref - what you have there
>> > stringifies it and there isn't a file handle called GLOB(0x12345678)
>> > so it fails - you need to use three-arg form:
>> > 
>> >open STDOUT ,">&",$stdout
>> > 
>> > should work.
>> 
>> well I was writing a patch for perlfunc, and then I've tested it -- it 
>> doesn't work,
>> 
>>open STDOUT ,">&" . fileno($stdout)
>> 
>> as suggested by Rafael does work, but that's ugly and not perlish :(
>> 
>> Neither the code in perlfunc open()'s section's example works, somebody 
>> changed the old working code without testing and broke it.
> 
> 1: To me this specific thing sounds like a serious bug.
>(scoring +1 because it breaks a documentation example, and +1 because
> the $someone who hacked the core in the area thinks it should work,
> but
> it doesn't)
> 
> 2: (For the perl-qa people) Is there a workable solution yet to making
>a tool to auto-test all the code examples in the pod?

I hacked once something together, but it stumbled on some silly thing
like "how to mark example code that should be tested". 

I proposed just to test everything and then clean up - but that is probably
too much work.

Cheers,

Tels

- -- 
 perl -MDev::Bollocks -e'print Dev::Bollocks->rand(),"\n"'
 evangelistically repurpose compelling markets

 http://bloodgate.com/perl   My current Perl projects
 PGP key available on http://bloodgate.com/tels.asc or via email

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iQEVAwUBPJjMSHcLPEOTuEwVAQHv2gf9F9XPqWcpDpzJ0LQRGwhOZZR57xxfRB2D
i44krk8SiyL/3N6fi45QDATlgHPj4FkO127TTVeVbIeE93pQhJ22o2apAuE9JEMj
S6ViEv7Ip2OHxMUftKfi4BmH7Y3+WTPXW3CQDm8pA34Avlz9zEE7EJt1IoG/uKFv
ZYWHDgmxMeqjgoEqFzmI+0V3mEkXk6bGhQWzWNpCVY0W0sMweTAWQiVEnoLwK99v
8QVLrbyAsU5E6JtJaAwjssmmQshyt0EAoe7yFhQNWK1YVhGeb2FYN8HT/WtSjvrO
Weve0yd2v6Ak7C8eltutZhK5X1tlgMMG9/A5bV/uz8fYi39fsIJKnQ==
=yi00
-END PGP SIGNATURE-



Re: [ID 20020318.003] cannot open STDOUT into in memory variable

2002-03-20 Thread Nick Ing-Simmons

Nicholas Clark <[EMAIL PROTECTED]> writes:
>On Wed, Mar 20, 2002 at 09:13:11PM +0800, Stas Bekman wrote:
>> Nick Ing-Simmons wrote:
>
>> > For lexicals like your $stdout it is a glob ref - what you have there
>> > stringifies it and there isn't a file handle called GLOB(0x12345678)
>> > so it fails - you need to use three-arg form:
>> >
>> >open STDOUT ,">&",$stdout
>> >
>> > should work.
>>
>> well I was writing a patch for perlfunc, and then I've tested it -- it
>> doesn't work,
>>
>>open STDOUT ,">&" . fileno($stdout)
>>
>> as suggested by Rafael does work, but that's ugly and not perlish :(

Quite.

>>
>> Neither the code in perlfunc open()'s section's example works, somebody
>> changed the old working code without testing and broke it.
>
>1: To me this specific thing sounds like a serious bug.
>   (scoring +1 because it breaks a documentation example, and +1 because
>the $someone who hacked the core in the area thinks it should work, but
>it doesn't)

One $someone that changed it was me. I thought I had tested it and it worked
at the time - it is still not entirely clear why it doesn't - it is
going through all the motions - dup(2)-ing things all over the place.
I suspect that a patch for threading-dup stuff has tangled with
an n-arg-open and perlio patch...


>
>2: (For the perl-qa people) Is there a workable solution yet to making
>   a tool to auto-test all the code examples in the pod?
>
>3: And if so can it detect code that is added without tests?
>   (as opposed to code added with an explicit "exempt this code from testing)
>
>Nicholas Clark
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/