Subject: | END { $global_phase_destroy++ } clause breaks in speedy persistent perl |
In this diff (between -$VERSION = '0.08124' and +$VERSION = '0.08127')
, there is a block of text here, that breaks speedy perl
implementations. To test the code, you write a simple script to run a
derived Schema object. If you run this under speedy, it will run OK
once, but not any subsequent times. under normal perl, it runs ok each
time. As a workaround, I commented out the "END" block and it worked
ok in speedy and normal perl.
--- /alternative/usr/local/share/perl/5.10.1/DBIx/Class/Schema.pm
2011-01-11 05:08:05.000000000 -0500
+++ ./Schema.pm 2011-01-25 18:53:36.000000000 -0500
@@ -1372,6 +1379,29 @@
$self->class_mappings(\%map);
}
+{
+ my $global_phase_destroy;
+
+ #BREAKS-speedy END { $global_phase_destroy++ }
+
+ sub DESTROY {
+ return if $global_phase_destroy;
+
+ my $self = shift;
+ my $srcs = $self->source_registrations;
+
+ for my $moniker (keys %$srcs) {
+ # find first source that is not about to be GCed (someone other
than $self
+ # holds a reference to it) and reattach to it, weakening our own
link
+ if (ref $srcs->{$moniker} and svref_2object($srcs->{$moniker})-
Show quoted text
>REFCNT > 1) {
+ $srcs->{$moniker}->schema($self);
+ weaken $srcs->{$moniker};
+ last;
+ }
+ }
+ }
+}
+
Please make this code speedy/perperl compliant, as the version 0.08124
was. Thanks.
perl -v
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
uname -a
Linux vWLAN-80002509000003 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr
16 09:39:35 UTC 2010 i686 GNU/Linux