this is entirely off-topic for dbi-users. That said, what you're seeing is
due to $q->param('dow') called in array context returning some number
of things other than one thing. There are various ways to fix it,
depending on how $q works. The approach you tried, putting one of the
param lookups inside an anon arrayref constructor, is halfway there --
you need to reach into that array later when you use it.

The situation is also a subtle security flaw, as a user can in theory
construct funny form data with multiple entries for names and
overwrite
for instance shift_beg by giving three 'factory' data, the middle one
being 'shift_beg." Wrapping one of them in square brackets doesn't
help with the general exploit.

>> my %attrs = (
>>        shift_name => $q->param('shift_name'),
>>        shift_beg => $q->param('shift_beg'),
>>        shift_end => $q->param('shift_end'),
>>        shift_days => $q->param('dow'),
>>        factory_id => $q->param('factory'),
>> );

This:

my %attrs = (
        shift_name =>  scalar($q->param('shift_name')),
        shift_beg =>  scalar($q->param('shift_beg')),
        shift_end =>  scalar($q->param('shift_end')),
        shift_days => scalar( $q->param('dow')),
        factory_id => scalar( $q->param('factory')),
);

will always give you exactly one thing in the value slots, then
depending on what you see there you can adjust.


-- 
"[Feynman]'s wife was granted a divorce from him because of [his]
constantly working calculus problems in his head as soon as awake,
while driving car, sitting in living room, and so forth, and that his
one hobby was playing his African drums. His ex-wife reportedly
testified that on several occasions when she unwittingly disturbed
either his calculus or his drums he flew into a violent rage, during
which time he choked her, threw pieces of bric-a-brac about and
smashed the furniture." -- FBI

Reply via email to