This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
__DATA__ and packages
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 22 Dec 2001 00:01:29 +0000 (01:01 +0100)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 21 Dec 2001 22:32:14 +0000 (22:32 +0000)
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"});
        }
     }
 }