develooper Front page | perl.perl5.porters | Postings from March 2000

Re: Perl friends and eval and $SIG{__DIE__}.

From:
Matt Sergeant
Date:
March 16, 2000 08:47
Subject:
Re: Perl friends and eval and $SIG{__DIE__}.
Message ID:
00031616484602.30528@dougal.sergeant.org
On Thu, 16 Mar 2000, Sam Tregar wrote:
> On Thu, 16 Mar 2000, Matt Sergeant wrote:
> 
> > > Users of CGI::Carp don't call any
> > > methods, they just do a 'use CGI::Carp qw(fatals_to_browser);'.  How can
> > > your method work via a 'use' statement?
> > 
> > With a CORE::die overload.
> 
> Sounds easy enough.  What's stopping the anti-$SIG{__DIE__} crew from
> putting together a patch?  I think you'd have a much easier time
> deprecating $SIG{__DIE__}'s "features" if you could get the mod_perl
> people off your backs.

Well it probably still breaks things, for one... But fair point - actions
speak louder than words...

(yes, I know the patch isn't perfect, but maybe it'll get things moving)

*** Carp.pm.orig        Sat Jan 23 23:44:44 1999
--- Carp.pm     Thu Mar 16 16:47:25 2000
***************
*** 190,199 ****
  
  @ISA = qw(Exporter);
  @EXPORT = qw(confess croak carp);
! @EXPORT_OK = qw(carpout fatalsToBrowser wrap set_message cluck);
  
  $main::SIG{__WARN__}=\&CGI::Carp::warn;
! $main::SIG{__DIE__}=\&CGI::Carp::die;
  $CGI::Carp::VERSION = '1.13';
  $CGI::Carp::CUSTOM_MSG = undef;
  
--- 190,199 ----
  
  @ISA = qw(Exporter);
  @EXPORT = qw(confess croak carp);
! @EXPORT_OK = qw(carpout fatalsToBrowser wrap set_message cluck die);
  
  $main::SIG{__WARN__}=\&CGI::Carp::warn;
! #$main::SIG{__DIE__}=\&CGI::Carp::die;
  $CGI::Carp::VERSION = '1.13';
  $CGI::Carp::CUSTOM_MSG = undef;
  
***************
*** 206,211 ****
--- 206,214 ----
      my($oldlevel) = $Exporter::ExportLevel;
      $Exporter::ExportLevel = 1;
      Exporter::import($pkg,keys %routines);
+     if ($routines{'fatalsToBrowser'}) {
+         $pkg->export('CORE::GLOBAL','die');
+     }
      $Exporter::ExportLevel = $oldlevel;
  }


-- 
<Matt/>

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About