Subject: | Circular reference errors |
Date: | Mon, 02 Jul 2012 19:44:26 +0100 |
To: | bug-Catalyst-TraitFor-Component-ConfigPerSite [...] rt.cpan.org |
From: | Nick <nick [...] webcraftcs.com> |
I am currently using the Catalyst-TraitFor-Component-ConfigPerSite
modules in my application, currently with two websites configured.
I have run it using CatalystX::LeakChecker and it throws up an error:
Visiting the first website (www.website1.com) I get:
[debug] Circular reference detected:
.------------------------------------------------------------------------.
| $ctx->{stash}->{site_config}->{TraitFor::Component::ConfigPerSite}->{- |
| www.website1.com} |
'------------------------------------------------------------------------'
and then visiting the second (www.website2.com) I get:
[debug] Circular reference detected:
.------------------------------------------------------------------------.
| $ctx->{stash}->{site_config}->{TraitFor::Component::ConfigPerSite}->{- |
| www.website2.com}->{TraitFor::Component::ConfigPerSite} |
| $ctx->{stash}->{site_config}->{TraitFor::Component::ConfigPerSite}->{- |
| www.website1.com} |
'------------------------------------------------------------------------'
In the debug output, it clearly shows some sort of circular referencing
taking place:
$a->{"static"}{include_path}[0] = $a->{"root"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"email"}
= $a->{"email"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"Plugin::Authentication"}
= $a->{"Plugin::Authentication"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"Plugin::ConfigLoader"}
= $a->{"Plugin::ConfigLoader"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"Plugin::Session"}
= $a->{"Plugin::Session"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"root"} =
$a->{"root"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"stacktrace"}
= $a->{"stacktrace"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"static"}
= $a->{"static"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"TraitFor::Component::ConfigPerSite"}
= $a->{"TraitFor::Component::ConfigPerSite"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"Action::RenderView"}
= $a->{"Action::RenderView"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"email"} =
$a->{"email"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"Plugin::Authentication"}
= $a->{"Plugin::Authentication"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"Plugin::ConfigLoader"}
= $a->{"Plugin::ConfigLoader"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"Plugin::Session"}
= $a->{"Plugin::Session"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"root"} =
$a->{"root"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"stacktrace"}
= $a->{"stacktrace"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"static"} =
$a->{"static"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"TraitFor::Component::ConfigPerSite"}
= $a->{"TraitFor::Component::ConfigPerSite"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"View::Email"} =
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::Email"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"View::JSON"}
=
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::JSON"};
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website1"}{"View::TT"} =
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::TT"};
$a->{"View::Email"} =
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::Email"};
$a->{"View::JSON"} =
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::JSON"};
$a->{"View::TT"} =
$a->{"TraitFor::Component::ConfigPerSite"}{"www.website2.com"}{"View::TT"};
$a;
So far, I have been unable to resolve this despite trying to employ
Scalar::Util::weaken to avoid the circular referencing.
Any help would be greatly appreciated.
Thank you
Nick