<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1443455483434_9943"><span id="yui_3_16_0_1_1443455483434_10178">You shouldn't try to change the configuration once setup if finished since at that point everything has been initialized. if you change stuff there its not going to do anything. Whats the actual use case you are trying to achieve here.</span></div><div id="yui_3_16_0_1_1443455483434_9943"><span><br></span></div><div id="yui_3_16_0_1_1443455483434_9943"><span id="yui_3_16_0_1_1443455483434_10077">FWIW Calling $c->config for application scoped stuff is ok I believe (no change, just getting the data). For example if I really need to do a plugin, I usually do like:</span></div><div id="yui_3_16_0_1_1443455483434_9944"><span><br></span></div><div id="yui_3_16_0_1_1443455483434_9945" class="">my $adaptor_namespace = sub {</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> my $app = shift;</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> if(my $config = $app->config->{'Plugin::InjectionHelpers'}) {</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> my $namespace = $config->{adaptor_namespace};</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> return $namespace if $namespace;</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> }</div><div id="yui_3_16_0_1_1443455483434_9945" class=""> return 'Catalyst::Model::InjectionHelpers';</div><div id="yui_3_16_0_1_1443455483434_9945" dir="ltr" class="">};</div><div id="yui_3_16_0_1_1443455483434_9945" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1443455483434_9945" dir="ltr" class="">to create a way for the plugin to have stuff in the config. In this case I also created an anonymous code ref instead of a normal method so that the plugin would not pollute the application namespace so much.</div> <br><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font size="2" face="Arial"> On Friday, September 25, 2015 8:40 AM, Bill Moseley <moseley@hank.org> wrote:<br> </font> </div> <br><br> <div class="y_msg_container"><div id="yiv9327025887"><div dir="ltr"><div>I'm confused about this rather stern note in Catalyst.pm.</div><div><br></div><div>Is this the following wrapper related to the text in the NOTE?</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px;"><div><div>B<NOTE:> you MUST NOT call C<< $self->config >> or C<< __PACKAGE__->config >></div></div><div><div>as a way of reading config within your code, as this B<will not> give you the</div></div><div><div>correctly merged config back. You B<MUST> take the config values supplied to</div></div><div><div>the constructor and use those instead.</div></div><div><div><br></div></div><div><div>=cut</div></div><div><div><br></div></div><div><div>around config => sub {</div></div><div><div> my $orig = shift;</div></div><div><div> my $c = shift;</div></div><div><div><br></div></div><div><div> croak('Setting config after setup has been run is not allowed.')</div></div><div><div> if ( @_ and $c->setup_finished );</div></div><div><div><br></div></div><div><div> $c->$orig(@_);</div></div><div><div>};</div></div></blockquote><div><br></div><div>I understand the NOTE for Model/View/Controllers where the component's __PACKAGE__->config is merged in with the application config for that component. Calling $self->config won't be the same thing passed to the component's constructor.</div><div><br></div><div>But, what's the issue with calling $c->config( foo => 123 ) at runtime? Or even $c->config( \%new_config )? </div><div><br></div><div>Note that wrapper only applies to calling config on the app class, and does not apply to Model/View/Controllers.</div><div><br></div><div>Is there some other issues I'm missing? What problem is that wrapper trying to prevent?</div><div><br></div><div>Thanks,</div><div><br></div><div><br></div>-- <br><div class="yiv9327025887gmail_signature">Bill Moseley<br><a rel="nofollow" ymailto="mailto:moseley@hank.org" target="_blank" href="mailto:moseley@hank.org">moseley@hank.org</a></div>
</div></div><br>_______________________________________________<br>List: <a ymailto="mailto:Catalyst@lists.scsys.co.uk" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br><br><br></div> </div> </div> </div></div></body></html>