Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi ChOas you might note that what I posted at 19:04 (an hour before caillte for what it is worth) indicated the bugs in your posted code.

Should I give you hints, or should I write your code?

This is completely your choice. Your hint (check the result of rename and print the error in $! was excellent and got a ++ Give a man a fish and he will eat today. Teach a man to fish and he shall eat forever. On the other hand your example code was broken and got a -- When I noted that it had quite a high reputation it also got a direct reply to you. I feel if you post code it should work properly otherwise it does no one any good

Trying to rename a file, and failing to do so (for any reason), should result in an error message, and should not be quietly dismissed.

You are of course correct. While throwing an exception with die is one way of dealing with errors it is usually not a good way in a CGI. I usually have a die_nice() function in my CGIs that looks something like:

sub die_nice { my $real_error = shift; email($administrator, $real_error); log_error(scalar localtime, $real_error); tell_user('Sorry the system can not respond to your request due to + routine maintenance <br>Please try again later') # yeah, right! exit; }

One problem with a simple print is that without a valid header a CGI will fall over with a 500 internal server error.

You seem to have taken it a little to heart so may be amused to find that I have posed similar questions to yours at What's a fair thing? and So it's homework - so what? All the best and keep up the good work. ++ for this one BTW.




In reply to Re: Should I write your code ? by tachyon
in thread Should I write your code ? by ChOas

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: A good morning and weekstart to you too, Discipulus!
    Discipulus last day of work before holidays.. He put a reminder on his cell

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2018-06-25 07:16 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.