package Shell;
use strict;
$SIG{__DIE__} = \&catch_die;


sub catch_die {
    my $error=shift;
    my $LBPATH;
    my $pgm = $0;
    $pgm =~s/\\/\//g;
    $pgm =~s/^.*\/([^\/]+)$/$1/g;
    foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'}) {
            s!\\!/!g; s/^(.*)\/[^\/]+$/$1/g;
            if (-e $_ . '/' .$pgm) { $LBPATH = $_; last; }
     }
    $error=~s!\\!/!g;
    $error =~ s!$ENV{'DOCUMENT_ROOT'}!/<b>您的WEB絕對路徑</b>!i;
    $error =~ s!$LBPATH!/<b>您的腳本絕對路徑</b>!i;
    my ($msg, $path) = split " at ",$error;
    print "content-type:text/html;charset=big5\n\n";
    print qq~
    <html>
    <head><title>雷傲論壇CGI執行錯$hk6137!</title></head>
    <body bgcolor='#FFFFFF'>
    <font face='Arial' size='5' color='#333366'>LeoBoard CGI Error !</font>
    <hr size='1' color='#000000' noshade>
    <font face='Arial' size='3' color='#00000'>
    雷傲論壇程式已經正常登出,因為遇到了如下錯$hk6137:
    <br><br><b>$msg</b><br><br>此錯$hk6137發生在以下位置: <font color='#000099' face='Arial'>$path</font>
    <br><br><font size='3' color='#990000'><b>請注意,為了您的網站安全,您的絕對路徑已經被隱藏.</b></font>
    </font>
     <br><br><hr size='1' color='#000000' noshade>
    <table width=80% align=center cellpadding=0 cellspacing=0 border=0><tr><td align=center><font color=#000000>&copy; 中文版權所有： <a href=http://www.cgier.com>CGI 編程者之家</a>　繁體翻譯：<a href="http://www.bbs-hk.com/">紫荊論壇</a>　版本： <a href="http://www.leoboard.com/download.htm">$LB::VERSION</a></font></td></tr></table>
	</body>
    </html>
    ~;
    close(STDOUT);
    exit;
} 


1;
