develooper Front page | perl.perl5.porters | Postings from March 2000

Re: inappropriate warning

Thread Previous
Tom Christiansen
March 20, 2000 11:27
Re: inappropriate warning
Message ID:
>Tom Christiansen <> writes:

>>     % perl -we 'open($fh, "</dev/null"); print $fh "stuff\n"'
>>     Filehandle main::$fh opened only for input at -e line 1.

>main::$fh? I'd call that more than just misleading. I could live with
>$main::fh, though.

Sorry, I wasn't talking about those; I've been through those
confusions myself, although I don't know whether the outcome was
ever written down anywhere.  I was this time talking about

    % perl -we '$io = *STDIN{IO}; print $io "stuff\n"'
    Use of uninitialized value in print at -e line 1.
    Filehandle  opened only for input at -e line 1.

BTW, this dumps core:

    % perl -we 'write(*STDOUT{IO})';

Program received signal SIGSEGV, Segmentation fault.
0xaf87d in Perl_pp_enterwrite () at pp_sys.c:1176
1176                DIE(aTHX_ "Undefined format \"%s\" called",SvPVX(tmpsv));
(gdb) bt
#0  0xaf87d in Perl_pp_enterwrite () at pp_sys.c:1176
#1  0x6521b in Perl_runops_debug () at run.c:56
#2  0x577d in S_run_body (oldscope=1) at perl.c:1395
#3  0x5382 in perl_run (my_perl=0xf5030) at perl.c:1319
#4  0x177f in main (argc=3, argv=0xefbfd63c, env=0xefbfd64c) at perlmain.c:52

Same thing if format STDOUT is defined, though.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About