develooper Front page | perl.beginners | Postings from January 2002

Resume after die?

Thread Next
From:
Richard J. Barbalace
Date:
January 3, 2002 17:43
Subject:
Resume after die?
Message ID:
200201040143.UAA03092@x15-cruise-basselope.mit.edu
I'm looking into ways to do resumptive exception handling in Perl.  For
example, I have something equivalent to:
	 eval {
	    # Code where an error may occur
	    die "Here's an exception";
	    # Code where I want to resume after handling the exception
	    print "Continuing....\n";
	 };
	 if ($@) {
	    # Handle the exception
	    # Resume at the line following the exception
	 }

Is there a way of resuming after the die statement?  If not, is there
a standard way of resuming after exception handling in Perl?  I have
code that allows redoing the entire eval block or simply continuing
after the eval block, but I have not found any way to resume inside
the eval block.

+ Richard J. Barbalace
  Cambridge, MA

Thread Next


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