Unix SunOS 5.6 environment and Perl 5.005_02.

According to the man page for the File::Path module, when using rmtree I should be able to catch warnings with rmtree. Will this catch warnings when rmtree fails to remove a file with the following usage:
rmtree("/tmp/tempdir",0,1);

Let's say I don't have permission to remove the file "foo" in the tempdir directory. I would then be unable to remove the tempdir directory. Will I get a warning with this? I have tried to setup the following to catch a warning:
$SIG{'__WARN__'} = sub { die $_[0] }; rmtree("/tmp/tempdir",0,1); $SIG{'__WARN__'} = 'DEFAULT';

But I am not catching a warning for failure to remove the directory or it's contents.

Any help with this would be great. For now I am just verifying that the directory is gone with a (-d <dir>) and, while that works, I don't get details about the failure. I was under the impression that because the return value from rmtree is the number of files removed that I had to catch the __WARN__ signal to know that it failed and to get the details.

All help is greatly appreciated.

Shannon

In reply to rmtree __WARN__ by skerr1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.