From: Dave R. <au...@ur...> - 2005-10-03 16:09:09
|
On Mon, 3 Oct 2005, Scott Lanning wrote: > On Mon, 3 Oct 2005, Paul D. Kraus wrote: >> I have a form that has a bunch of check boxes. If they select more then two >> then mason see the variable as an array reference. If they only select 1 >> then it sets the variable to value. >> >> I need to test if its an array reference. Any good way to do this? > > In Bricolage it's done like > > # in some module: > > package Bric::App::Util; > sub mk_aref { ref $_[0] ? $_[0] : defined $_[0] ? [$_[0]] : [] } If you're using this for HTML forms you'd probably want to check the length of $_[0] as well, since an empty text field will end up coming in as ''. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/ |