develooper Front page | perl.perl5.porters | Postings from February 2011

C<use autodie> unravels C<use strict>

Thread Next
From:
Tom Christiansen
Date:
February 27, 2011 06:49
Subject:
C<use autodie> unravels C<use strict>
Message ID:
26158.1298818135@chthon
Everything I touch today crumbles in my hands.

When you use autodie, you implicitly declare legal
any scalar variable whose name matches that of any
function it "fatalizes".

Here's a (partial) dump of %main:: during the compilation
and run of the enclosed program:

    BEFORE AUTODIE  => $0 @ARGV %ENV @INC %INC @_ &dump_main &func1 &funcU
    AFTER AUTODIE   => $0 @ARGV %DOES %ENV @INC %INC %SIG @_ &accept &bind &binmode &carp &chdir &close &closedir &confess &connect &croak &dbmclose &dbmopen &dump_main &fcntl &fileno &flock &fork &func1 &funcU &getsockopt &ioctl &link &listen &mkdir &msgctl &msgget &msgrcv &msgsnd &open &opendir &pipe &read &readlink &recv &rename &rmdir &seek &semctl &semget &semop &send &setsockopt &shmctl &shmget &shmread &shutdown &socketpair &symlink &sysopen &sysread &sysseek &syswrite &truncate &umask &unlink
    DONE COMPILING  => $0 @ARGV %DOES %ENV @INC %INC %SIG @_ &carp &confess &croak &dump_main &func1 &funcU
    BEGIN PROGRAM   => $0 @ARGV %DOES %ENV @INC %INC %SIG @_ &carp &confess &croak &dump_main &func1 &funcU
    END PROGRAM     => $0 @ARGV %DOES %ENV @INC %INC %SIG @_ &carp &confess &croak &dump_main $fork &func1 $func1 &funcU $funcU $open $pipe $read $recv $seek $send

Blech!

Tested under v5.12.3, v5.13.9, and v5.13.10-33-g149d510.

--tom


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