This is part of a admin program that creates a sub-dir. I want the program to die when the admin enters a dir that already exists. I get Internal Server Error instead of the 'die' message...can't figure out what's missing.:
require 'cgi.pm'; $database_location="/home/sites/www.foo.net/web/test/data/upload.db"; $dir_location = "/home/sites/www.foo.net/web/test/"; sub diedebug { local($msg) = $_[0]; $msg =~ s/^nodie//; print "$msg<br>\n"; exit(); } %in = (); &ReadParse(%in); # Parse the data submitted by the user if (($in{'company_name'}) && ($in{'password'}) && ($in{'sub_dir'})) { $dir= $in{'sub_dir'}; mkdir("$dir_location$dir", 0777) || &diedebug("<html> <center><table +CELLSPACING=0 CELLPADDING=1 BORDER=0 width=262> <tr align=center bgcolor=navy> <td><center> <table CELLSPACING=0 CELLPADDING=1 BORDER=0 width=260> <tr align=center bgcolor=navy><td bgcolor=navy colspan=2 +><font face=arial size=2 color=white><SMALL>DIRECTORY CREATION ERROR< +/small></FONT></td></tr> <tr><td bgcolor=#c0c0c0 width=60% colspan=2><font size=- +1>You are trying to create a directory that already exists! Go back +and use a different name for this particular directory.<BR></td></tr> <tr align=center><td bgcolor=navy colspan=2><font face=AR +IAL size=2 color=white><SMALL>ERROR ~ DIRECTORY NOT CREATED!</td></tr +> </table> </td></tr></table><BR></center>");
Thanks!

In reply to Can't Seem To DIE by koacamper

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.