develooper Front page | perl.perl5.porters | Postings from December 2001

[ID 20011229.003] problem with write() and a tie()d filehandle

Thread Next
From:
Abe Timmerman
Date:
December 29, 2001 12:29
Subject:
[ID 20011229.003] problem with write() and a tie()d filehandle
Message ID:
e79s2ugda2ivai067la31p1evegvfp4s4q@4ax.com
This is a bug report for perl from abe@ztreet.demon.nl,
generated with the help of perlbug 1.33 running under perl v5.7.2.


-----------------------------------------------------------------
[Please enter your report here]

write() on a tie()d filehandle complains about an unopened filehandle.

The printf() on the that same tie()d filehandle works ok.

I looked at the documentation but couldn't find any mention of write() not beeing
supported.

This program demonstrates it (confirmed for ActivePerl 5.6.1 build 628).

#!perl
use warnings FATAL => 'all';
use strict;

{
    package FakeOut;
    sub TIEHANDLE { bless \( my $scalar ), shift; }
    sub PRINT     { my $self = shift; $$self .= shift; }
    sub PRINTF    { 
        my $self = shift; 
        my $fmt = shift; 
        $$self .= sprintf $fmt, @_;
    }

}

my( $text, $numb );
format FAKEOUT =
@<<<<<<<<<< @>>>>>
$text,      $numb
..

my $fake = tie *FAKEOUT, 'FakeOut';
foreach $text ( qw( one two three four five ) ) {
    $numb = length $text;
#    printf FAKEOUT "%-10s %5s\n", $text, $numb;
    write FAKEOUT;
}

print $$fake;

__END__

write() on unopened filehandle FAKEOUT at tiedwrite.pl line 27.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.7.2:

Configured by a.timmerman at Sat Dec 15 02:26:14 2001.

Summary of my perl5 (revision 5 undef) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT   -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-O1 -MD -DNDEBUG',
    cppflags='-DWIN32'
    ccversion='undef', gccversion='', gccosandvers='undef'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"c:\opt\perl572\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib
mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=undef
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl57.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"c:\opt\perl572\lib\CORE"  -machine:x86'

Locally applied patches:
    DEVEL13686

---
@INC for perl v5.7.2:
    c:/opt/perl572/lib
    c:/opt/perl572/site/lib
    .

---
Environment for perl v5.7.2:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=c:\opt\perl572\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;C:\Perl\bin\;C:\usr\bin\;C:\usr\bin;C:\bin;C:\usr\local\bin;c:\usr\local\openssl\bin;C:\gcc-2.95.2\bin;C:\PROGRA~1\ULTRAE~1;C:\Program
Files\SecureCRT 3.0;C:\Program Files\Microsoft Visual
Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual
Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin
    PERLDOC_PAGER=less
    PERL_BADLANG (unset)
    SHELL (unset)

groetje,

Abe
-- 
perl -wle '%_=qw(Just Just another Perl Perl another hacker hacker);print join" ",map$_{$_}=>sort keys%_'


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About