Changeset 24387
- Timestamp:
- 11/20/08 10:11:46 (5 years ago)
- Location:
- lang/perl/CGI-ExceptionManager/trunk
- Files:
-
- 2 modified
-
lib/CGI/ExceptionManager.pm (modified) (5 diffs)
-
xt/01_podspell.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/CGI-ExceptionManager/trunk/lib/CGI/ExceptionManager.pm
r24363 r24387 6 6 use CGI::ExceptionManager::StackTrace; 7 7 8 sub detach { die { finished => 1 }}8 sub detach { die bless [], 'CGI::ExceptionManager::Exception' } 9 9 10 10 sub run { … … 14 14 local $SIG{__DIE__} = sub { 15 15 my ($msg) = @_; 16 if (ref $msg eq ' HASH' && $msg->{finished}) {16 if (ref $msg eq 'CGI::ExceptionManager::Exception') { 17 17 undef $err_info; 18 18 } else { … … 40 40 =head1 NAME 41 41 42 CGI::ExceptionManager - 42 CGI::ExceptionManager - DebugScreen with detach! 43 43 44 44 =head1 SYNOPSIS … … 47 47 CGI::ExceptionManager->run( 48 48 callback => sub { 49 print "Content-Type: text/html\r\n\r\n"; 50 print "ktkr!\n"; 49 redirect("http://wassr.jp/"); 51 50 52 CGI::ExceptionManager->detach();51 # do not reach here 53 52 }, 54 53 powered_by => 'MENTA', 55 54 ); 56 55 56 sub redirect { 57 my $location = shift; 58 print "Status: 302\n"; 59 print "Location: $location\n"; 60 print "\n"; 61 62 CGI::ExceptionManager::detach(); 63 } 64 57 65 =head1 DESCRIPTION 58 66 59 Just a Proof of Concept. 67 You can easy to implement DebugScreen and Detach architecture =) 68 69 =head1 METHODS 70 71 =over 4 72 73 =item detach 74 75 detach from current context. 76 77 =item run 78 79 CGI::ExceptionManager->run( 80 callback => \&code, 81 powered_by => 'MENTA', 82 ); 83 84 run the new context. 85 86 =back 60 87 61 88 =head1 AUTHOR … … 63 90 Tokuhiro Matsuno E<lt>tokuhirom@gmail.comE<gt> 64 91 92 Kazuho Oku 93 65 94 =head1 SEE ALSO 95 96 L<Sledge::Plugin::DebugScreen>, L<http://kazuho.31tools.com/nanoa/nanoa.cgi>, L<http://gp.ath.cx/menta/> 66 97 67 98 =head1 LICENSE -
lang/perl/CGI-ExceptionManager/trunk/xt/01_podspell.t
r24363 r24387 31 31 maki 32 32 TODO 33 Kazuho 34 Oku 35 DebugScreen
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)