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

inappropriate warning

Thread Next
Tom Christiansen
March 20, 2000 08:18
inappropriate warning
Message ID:
First, let me point out (again :-) that these IO thingies should
not be touted as user-accessible:

    % perl -we '$io = *STDIN{IO}; print STDIN "stuff\n"'
    Name "main::io" used only once: possible typo at -e line 1.
    Filehandle main::STDIN opened only for input at -e line 1.

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

    % perl -we '$io = *STDOUT{IO}; print $io "stuff\n"'

    % 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.

That warning message is misleading: it's not *my* value that's
unintialized.  But I fear that this one you're not going to be able
to fix unless there's something added in the xpvio to let you back
to the gv to find a name, perhaps per gsar's lexical autoviv trick
where he stashes the name on the anon glob.  But it's not clear to
me that that will always be possible.  Can you have an io that
didn't come from a glob?


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