<?xml version="1.0" encoding="windows-1252"?>
<node id="307056" title="Re: Unwrapping values in a template" created="2003-11-14 09:35:42" updated="2005-07-27 05:19:45">
<type id="11">
note</type>
<author id="34691">
Chmrr</author>
<data>
<field name="doctext">
&lt;p&gt;As long as all of your lines that are definitions start with whitespace, the following will work; this is because when the template wraps, it won't prefix the (wrapped) line with anything.  This allows us to know what's a wrap, and what's not.  No special handling of '=' signs needed.&lt;/p&gt;
&lt;code&gt;use Config::General;
use Data::Dumper;

undef $/;
my $file = &lt;DATA&gt;;

$file =~ s/\n(\S)/ $1/g;

my $config = Config::General-&gt;new(-String=&gt;$file);

print Dumper {$config-&gt;getall};

__DATA__
  foo                = Yes
  bar                = 0
  blort              = 
  home_url           =
http://www.foo.com/some/really/long/url?foo=bar&lt;/code&gt;
&lt;p&gt;Produces:&lt;/p&gt;
&lt;code&gt;$VAR1 = {
          'bar' =&gt; '0',
          'boo' =&gt; '',
          'blort' =&gt; '',
          'foo' =&gt; 'Yes',
          'home_url' =&gt; 'http://www.foo.com/some/really/long/url?foo=bar',
        };&lt;/code&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-34691"&gt;
&lt;p&gt;perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&amp;V"+@( NO CARRIER'&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
307043</field>
<field name="parent_node">
307043</field>
</data>
</node>
