This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl5db-refactor] Extract a function.
authorShlomi Fish <shlomif@shlomifish.org>
Sun, 30 Sep 2012 13:56:49 +0000 (15:56 +0200)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:29 +0000 (09:18 -0500)
_restore_options_after_restart() .

lib/perl5db.pl

index 0ff2770..a7db086 100644 (file)
@@ -1401,6 +1401,18 @@ sub _restore_breakpoints_and_actions {
     return;
 }
 
+sub _restore_options_after_restart
+{
+    my %options_map = get_list("PERLDB_OPT");
+
+    while ( my ( $opt, $val ) = each %options_map ) {
+        $val =~ s/[\\\']/\\$1/g;
+        parse_options("$opt'$val'");
+    }
+
+    return;
+}
+
 if ( exists $ENV{PERLDB_RESTART} ) {
 
     # We're restarting, so we don't need the flag that says to restart anymore.
@@ -1419,12 +1431,7 @@ if ( exists $ENV{PERLDB_RESTART} ) {
     _restore_breakpoints_and_actions();
 
     # restore options
-    my %opt = get_list("PERLDB_OPT");
-    my ( $opt, $val );
-    while ( ( $opt, $val ) = each %opt ) {
-        $val =~ s/[\\\']/\\$1/g;
-        parse_options("$opt'$val'");
-    }
+    _restore_options_after_restart();
 
     # restore original @INC
     @INC     = get_list("PERLDB_INC");