File 0001-Plugins-Call-initializers-in-correct-order.patch of Package perl-Scrappy

From 5e1432319fee575367a2dafd788c134a0b8f9c24 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 6 May 2014 09:32:13 +0200
Subject: [PATCH] Plugins: Call initializers in correct order

According to Class::MOP::Attribute manual:

Note that there is no guarantee that attributes are initialized in any
particular order, so you cannot rely on the value of some other attribute when
generating the default.

This is exactly what was being done, causing test failures ever since hash key
order was randomized (RT#82142):

Can't use an undefined value as an ARRAY reference at lib/Scrappy/Plugin.pm line 21.

Let's just initialize plugins() lazily -- it will still be initialized upon the
instance creation, since registry() will trigger it, just in the correct order
now.
---
 lib/Scrappy/Plugin.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/Scrappy/Plugin.pm b/lib/Scrappy/Plugin.pm
index abda24f..4b8edbb 100644
--- a/lib/Scrappy/Plugin.pm
+++ b/lib/Scrappy/Plugin.pm
@@ -31,8 +31,10 @@ has registry => (
 has plugins => (
     is      => 'ro',
     isa     => 'Any',
+    # registry() uses us in their initializer, defer our own
+    # initialization until then
+    lazy    => 1,
     default => sub {
-
         my @plugins = ();
 
         # fix for bug found by Patrick Woo
-- 
2.0.0.rc0

openSUSE Build Service is sponsored by