Charlie Harvey

Config::General arrayrefs and HTML::FormFu

I’m in the process of making a nicer backend for using Catalyst (which is lovely BTW). One of the things I’m playing with is using HTML::FormFu for making the forms. But this morning I got proper stuck on the simple task of populating a select box with options from my Config::General config file.

I know what you're going to say. How come you're not using YAML. Well, its mostly its weird treatment of tabs and spaces, which I’ve found annoying enough to make me dislike it. I once spent an hour at New Internationalist trying to debug a YAML config for FormBuilder. I ended up having to reindent one character at a time.

Anyhow the problem was pretty simple to solve in the end, but doesn't seem documented in exactly this context on the web much, at least not for the terms I was googling. If you want an arrayref for a select element in your HTML::FormFu form you need to specify multiple blocks with each block having a label and value for that option. Here's the one I used for my Writings media types.

<elements> name media id media type Select label Media size 1 <attributes> title Enter media type; href is special </attributes> <options> value txt label txt </options> <options> value href label href </options> <options> value pdf label pdf </options> <options> value ogg label ogg </options> <options> value odt label odt </options> <options> value sxw label sxw </options> </elements>

Kinda long-winded compared to the much nicer YAML way of doing it. But it works OK.


  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.