Mailing List Archive

'panic: cv_clone' and sub forward declaration
This is on:

Perl 5.001m + consolidated patches from Gurusamy Sarathy
SGI IRIX 5.2 (although I don't think it's system dependent)

Forward declaration of a subroutine (seen with a class constructor,
haven't checked with non-OO code) triggers a "panic: cv_clone" from
op.c when trying to access a lexically-scoped variable from inside an
anonymous subroutine in the constructor.

I've searched the nice front end to the bug database at
http://www.perl.com/perl/bugs/index.html but found nothing that looked
like what I'm seeing. I searched with regexps 'cv_clone' and
'sub;declaration'.

The script "bug-cv_clone.pl" dies for me with

panic: cv_clone: $master at ./t.pl line 15.

while the script "nobug-cv_clone.pl" run successfully.

Here are the two scripts:

===== begin bug-cv_clone.pl =====
#!/net/bin/perl5

package Foo;
sub make_it;

sub make_it {
my $class = shift;
my $self = {};
bless $self, $class;

my $master = 'allo';

$SIG{'INT'} = sub {
print $master,"\n";
};

$self;
}
package main;
$w = make_it Foo;
sleep(10);
===== end bug-cv_clone.pl =====

===== begin nobug-cv_clone.pl =====
#!/net/bin/perl5

package Foo;

sub make_it {
my $class = shift;
my $self = {};
bless $self, $class;

my $master = 'allo';

$SIG{'INT'} = sub {
print $master,"\n";
};

$self;
}
package main;
$w = make_it Foo;
sleep(10);
===== end nobug-cv_clone.pl =====

Marc Paquette | Marc.Paquette@Softimage.COM
Administrateur de Systemes / Sysadmin | Softimage Inc
tel: (514) 845-1636 ext. 3426 | 3510 Boulevard St-Laurent
fax: (514) 845-5676 | Montreal (Quebec) H2X 2V2