<div dir="ltr">Yeah, that works, or some general accessor on vhost.<br><br>Perhaps during configuration parsing, we keep a map from classname to instantiated object, and then clients can say $vhost-&gt;by_class(&quot;DJabberd::RosterStorage&quot;) and then the vhost iterates over all its instantiated objects looking for something that UNIVERSAL::isa(&quot;DJabberd::RosterStorage&quot;), finding first, say, &quot;DJabberd::RosterStorage::SQLite&quot; and caching that in some vhost member hashref to make lookup faster later.<br>
<br><br><div class="gmail_quote">On Wed, Aug 6, 2008 at 4:21 AM, Mika Raento <span dir="ltr">&lt;<a href="mailto:mikie@iki.fi">mikie@iki.fi</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For Jaiku I&#39;m keeping a hash of my instances by vhost name and adding<br>
a Jaiku-&gt;get($vhost) (paraphrased) instead of adding things to the<br>
VHost.<br>
<br>
Brad didn&#39;t diss it in the code review :-)<br>
<br>
 &nbsp; Mika<br>
<br>
2008/8/6 Jos I. Boumans &lt;<a href="mailto:jos@dwim.org">jos@dwim.org</a>&gt;:<br>
<div><div></div><div class="Wj3C7c">&gt; On 06 Aug 2008, at 02:22, Artur Bergman wrote:<br>
&gt;<br>
&gt;&gt; In fact, it should only be accessible through closures (Unless you store<br>
&gt;&gt; it somewhere) since we don&#39;t want any global state to mess with clustering.<br>
&gt;&gt;<br>
&gt;&gt; Cheers<br>
&gt;&gt; Artur<br>
&gt;&gt;<br>
&gt;&gt; On Aug 5, 2008, at 4:24 PM, Brad Fitzpatrick wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; I don&#39;t think this is a good change... RosterStorage is not a singleton.<br>
&gt;&gt;&gt; &nbsp;You can run multiple vhosts within a process, all with different<br>
&gt;&gt;&gt; RosterStorage mechanisms.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Tue, Aug 5, 2008 at 7:30 AM, &lt;<a href="mailto:commits@code.sixapart.com">commits@code.sixapart.com</a>&gt; wrote:<br>
&gt;&gt;&gt; &nbsp;r6532@coke: &nbsp;josboum | 2008-08-05 16:30:19 +0200<br>
&gt;&gt;&gt; &nbsp;* for several plugins it&#39;s not possible to access their object after the<br>
&gt;&gt;&gt; -&gt;register()<br>
&gt;&gt;&gt; &nbsp;phase is over; the object is then only referenced in closures.<br>
&gt;&gt;&gt; &nbsp;This patch adds a method, -&gt;singleton, to retrieve the object for later<br>
&gt;&gt;&gt; use. This is<br>
&gt;&gt;&gt; &nbsp;particularly useful for setting up applications a la<br>
&gt;&gt;&gt; DJabberd::Plugin::MyApp<br>
&gt;<br>
&gt;<br>
&gt; Good point. The goal here is to be able to manipulate the roster from your<br>
&gt; App class.<br>
&gt;<br>
&gt; Would it be acceptable to make the relevant plugin objects available through<br>
&gt; their<br>
&gt; vhost object, along the lines of:<br>
&gt;<br>
&gt; &nbsp;$plugin = $vhost-&gt;some_method(....):<br>
&gt;<br>
&gt; This would allow the vhost object to encapsulate all the plugins, and not<br>
&gt; expose them<br>
&gt; through any other way.<br>
&gt;<br>
&gt; The implementation needs a bit of more thought, as the $vhost method call is<br>
&gt; ideally<br>
&gt; as dumb as possible, but the MyApp class shouldn&#39;t need to knwo much about<br>
&gt; the internals.<br>
&gt;<br>
&gt; Let me know if this the right way to proceed, and I&#39;ll happily add the<br>
&gt; functionality<br>
&gt; in a more sane way.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; &nbsp;Jos Boumans<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.linkedin.com/in/josboumans" target="_blank">http://www.linkedin.com/in/josboumans</a><br>
&gt;<br>
&gt; &nbsp;How do I prove I&#39;m not crazy to people who are?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>