* Kiki <[EMAIL PROTECTED]> [2006-06-11 12:50]:
> So you got me looking into C::G and yes, I'm too lazy to dig
> into the docs. Anyways short question to which I found no
> obvious answer:
>
> Can C::G syntax express just an array of arrays (used to
> populate data tables via DBIC schema):
>
> [
> [ qw/artistid name/ ],
> [ 1, 'Popular Band' ],
> [ 2, 'Indie Band' ],
> ]
>
> so that I can just throw it into $schema->populate($moniker, $data); ?
No.
You could express the following:
{
Column => [ qw/artistid name/ ],
Row0 => [ 1, 'Popular Band' ],
Row1 => [ 2, 'Indie Band' ],
}
which is very easy to transform into the format you need.
The config will look messy, though, and as pointed out elsewhere
in the thread, you should design the config format and then write
code to support it, not vice versa. That would get you the
following:
{
Column => [ qw/artistid name/ ],
Row0 => {
artistid => 1,
name => 'Popular Band',
},
Row1 => {
artistid => 2,
name => 'Indie Band',
},
}
That’s still just a oneliner to transform.
Regards,
--
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/