Put this in front of your script:

$SIG{INT} = sub { print "I'll die\n"; exit 1; };

and try it again. You'll get the building blocks.

UPDATE: In http://perldoc.perl.org/perlvar.html search for SIG.

UPDATE2: Have a look at File::Temp. File system handling on unixoid operating systems do have a nice feature. You can open a file (result is a opened filehandle) and directly afterwards unlink the file. This has the result that you have a file you can write to and read from but which can't be seen in the directory listing. The better: As soon as you close the file explicitly in your program or implicitly by killing the program the file gets deleted as there is no reference to it anymore. IMHO this would be the right approach in your object.

McA


In reply to Re: DESTROY on CTRL+C by McA
in thread DESTROY on CTRL+C by gri6507

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.