__DATA__ and packages
Rafael Garcia-Suarez [Sat, 22 Dec 2001 00:01:29 +0000 (01:01 +0100)]
Message-ID: <20011222000129.A713@rafael>

p4raw-id: //depot/perl@13842

ext/B/B/Deparse.pm

index 7bf95df..778cec7 100644 (file)
@@ -561,9 +561,11 @@ sub compile {
 
        # Print __DATA__ section, if necessary
        no strict 'refs';
-       if (defined *{$self->{'curstash'}."::DATA"}{IO}) {
+       my $laststash = defined $self->{'curcop'}
+           ? $self->{'curcop'}->stash->NAME : $self->{'curstash'};
+       if (defined *{$laststash."::DATA"}{IO}) {
            print "__DATA__\n";
-           print readline(*{$self->{'curstash'}."::DATA"});
+           print readline(*{$laststash."::DATA"});
        }
     }
 }