-=| Jonathan Yu, Sat, Oct 10, 2009 at 11:23:11AM -0400 |=- > On Sat, Oct 10, 2009 at 5:01 AM, Damyan Ivanov <[email protected]> wrote: > > $ cat <<EOF > test.pl > > #!/usr/bin/perl > > use autodie qw(:all); > > > > chmod 0755, "/non-existent/file" or warn $!; > > > > print "I'm alive!\n"; > > EOF > > > > $ perl test.pl > > No such file or directory at test.pl line 4. > > I'm alive > > > > Expected result: script should die. > I suspect this isn't really a bug, but is by design. What happens if > you do the chmod without checking the return value?
Nothing. No warning, no death. This is how the code was in the first place and I was relying on autodie to catch the possible typo in the file name :) > The point of autodie is to make checking/warning as you do > unnecessary; if you do check it yourself, the calling context is > different (scalar context vs void context), which can make all the > difference. > > What happens if you do the same thing, but drop the "or warn $!" part? > Does it die then? If not, then we should forward the bug upstream. Nothing happens. -- dam
signature.asc
Description: Digital signature

