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

index baee447..0ff2770 100644 (file)
@@ -1379,23 +1379,10 @@ back into the appropriate spots in the debugger.
 
 use vars qw(@hist @truehist %postponed_file @typeahead);
 
-if ( exists $ENV{PERLDB_RESTART} ) {
-
-    # We're restarting, so we don't need the flag that says to restart anymore.
-    delete $ENV{PERLDB_RESTART};
+sub _restore_breakpoints_and_actions {
 
-    # $restart = 1;
-    @hist          = get_list('PERLDB_HIST');
-    %break_on_load = get_list("PERLDB_ON_LOAD");
-    %postponed     = get_list("PERLDB_POSTPONE");
-
-       share(@hist);
-       share(@truehist);
-       share(%break_on_load);
-       share(%postponed);
-
-    # restore breakpoints/actions
     my @had_breakpoints = get_list("PERLDB_VISITED");
+
     for my $file_idx ( 0 .. $#had_breakpoints ) {
         my $filename = $had_breakpoints[$file_idx];
         my %pf = get_list("PERLDB_FILE_$file_idx");
@@ -1411,6 +1398,26 @@ if ( exists $ENV{PERLDB_RESTART} ) {
         }
     }
 
+    return;
+}
+
+if ( exists $ENV{PERLDB_RESTART} ) {
+
+    # We're restarting, so we don't need the flag that says to restart anymore.
+    delete $ENV{PERLDB_RESTART};
+
+    # $restart = 1;
+    @hist          = get_list('PERLDB_HIST');
+    %break_on_load = get_list("PERLDB_ON_LOAD");
+    %postponed     = get_list("PERLDB_POSTPONE");
+
+    share(@hist);
+    share(@truehist);
+    share(%break_on_load);
+    share(%postponed);
+
+    _restore_breakpoints_and_actions();
+
     # restore options
     my %opt = get_list("PERLDB_OPT");
     my ( $opt, $val );