Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
We don't bite newbies here... much
 
PerlMonks  

Re: A couple of problems....

by chromatic (Archbishop)
on Oct 18, 2000 at 19:52 UTC ( [id://37409]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to A couple of problems....

If you've ever used exception handling in another language, it's not too unfamiliar in Perl. You can use eval to catch an exception thrown with die:
# code to open ERRLOG here eval { die "There's no way around this!"; }; if ($@) { print ERRLOG "Caught: $@!\n"; }

As for the directory deletion and warning, your code will always log a successful deletion, even if it fails. Try this:

if (rmdir ($_)) { open(LOG, ">>$logfile") or warn "discarding logfile output\n"; print LOG "Directory: $_ - has been deleted.\n"; close (LOG) or warn "Can't close: $!"; } else { warn "Cannot delete directory: $_ ($!)"; }

Replies are listed 'Best First'.
RE: Re: A couple of problems....
by djw (Vicar) on Oct 18, 2000 at 20:28 UTC
    I like it.

    Thank you very much. I'll have to ++ you tomorrow.

    Thanks,
    djw

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://37409]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.