A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Custom die Handler (Perl)

  1. #1
    Senior Member
    Join Date
    Oct 2000
    Posts
    518

    resolved

    Now, I want to create a custom "die" handler. So I have:

    Code:
    print "Content-Type: text/html\n\n";
    $SIG{__DIE__} = sub {print "Custom error: $_[0]";};
    
    require 'test2.pl';
    In test2.pl, I have:
    Code:
    die "test";
    1;
    Now, when I run the first script, instead of seeing "Custom error: test at blablablabla..........", I see the following:

    custom error: test at test2.pl line 1. custom error: test at test2.pl line 1. Compilation failed in require at C:\Inetpub\Scripts\test.pl line 3.

    Why is the custom error generated twice? And why did the compilation failed? Is it because the script "died" before parsing the "1;"?

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    have you tried to put an exit inside your die function?

    Musicman

  3. #3
    Senior Member
    Join Date
    Oct 2000
    Posts
    518

    resolved

    Yes I have, and now it works.

    But what is causing the strange output?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center