[Catalyst-commits] r8815 - / trunk/examples/CatalystAdvent/root/2008

zarquon at dev.catalyst.perl.org zarquon at dev.catalyst.perl.org
Wed Dec 10 21:17:16 GMT 2008


Author: zarquon
Date: 2008-12-10 21:17:16 +0000 (Wed, 10 Dec 2008)
New Revision: 8815

Added:
   trunk/examples/CatalystAdvent/root/2008/10.pod
Modified:
   /
   trunk/examples/CatalystAdvent/root/2008/7.pod
Log:
 r14538 at fenchurch:  kd | 2008-12-11 07:58:59 +1100
 emergency day 10 entry



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:14537
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
   + 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:14538
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909

Added: trunk/examples/CatalystAdvent/root/2008/10.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2008/10.pod	                        (rev 0)
+++ trunk/examples/CatalystAdvent/root/2008/10.pod	2008-12-10 21:17:16 UTC (rev 8815)
@@ -0,0 +1,45 @@
+=head1 Day 10.  Dealing with Config::General's inability to provide single item arrays.
+
+Today's recipe is very quick and simple, but scratches a minor irritation. L<Config::General> (Apache-style) is the default configuration file format, which is great for readability, and the ease with which non-programmers can modify it.  However, it doesn't deal with single item arrays well. That is if you have the following configuration:
+
+ <some_values>
+ want_an_array some data
+ </some_values>
+
+But this wil some out as a scalar:
+
+ print $c->{config}->{some_values}
+
+results in the output C< some data >.
+
+One way of fixing this is to just provide spurious extra keys in the config file:
+
+ <some_values>
+ want_an_array some data
+ want_an_array junk
+ </some_values>
+
+And now you have an array:
+
+ print $c->{config}->{some_values}
+ ARRAY(0x800d80)
+
+=head2 When it absolutely has to be an array and can have a length of 1.
+
+But this is not entireley satisfactory.  Enter L<Moose>:
+
+
+ setup' => sub {
+     use Moose::Autobox;
+     $_[0]->config->{some_values}{want_an_array} = [ $_[0]->config->{some_values}{want_an_array}->flatten ];
+ }
+
+And the problem is fixed!
+
+=head1 ACKNOWLEDGEMENTS
+
+Matt Trout (for the code), Jessie Sheidlower (for getting the code out of matt finally)
+
+=head1 AUTHOR
+
+Kieren Diment <zarquon at cpan.org>

Modified: trunk/examples/CatalystAdvent/root/2008/7.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2008/7.pod	2008-12-10 21:16:56 UTC (rev 8814)
+++ trunk/examples/CatalystAdvent/root/2008/7.pod	2008-12-10 21:17:16 UTC (rev 8815)
@@ -9,7 +9,11 @@
 cleanly under Windows.  On the other hand these failures are generally
 not going to stop a typical Catalyst installation from working,
 although watch out for Windows' eccentricities like signal handling in
-your app.
+your app.  Also, note that BerkelyDB takes some deep voodoo that's
+beyond me to work in Strawberry Perl (as well as administrator access
+to install Sun's msi installer), so avoid modules with these
+dependencies too if you want them to work with Strawberry at this
+stage.
 
 =head2 Step one, find a Windows machine.
 




More information about the Catalyst-commits mailing list