[Catalyst] HTML::FormHandler help!

Sungsam Gong gong.sungsam at gmail.com
Tue Mar 6 17:13:06 GMT 2012

Dear Gerda,

Thanks for making HTML::FormHandler, which I found very useful.

I was trying to make a simple registration page using
HTML::FormHandler, but couldn't make it through.
The form itself looks OK, but after clicking the submit button, I got
an error message which I dumped below:

Can't call method "insert" on an undefined value at
/home/sung/perl5/lib/perl5/DBIx/Class/Row.pm line 350. at
/home/sung/perl5/lib/perl5/DBIx/Class/Schema.pm line 1088
'Can\'t call method "insert" on an undefined value at /home/su...')
called at /home/sung/perl5/lib/perl5/DBIx/Class/Storage.pm line 111
'Can\'t call method "insert" on an undefined value at /home/su...')
called at /home/sung/perl5/lib/perl5/DBIx/Class/Storage.pm line 197
'Can\'t call method "insert" on an undefined value at /home/su...')
called at /home/sung/perl5/lib/perl5/DBIx/Class/Storage.pm line 218
	DBIx::Class::Storage::__ANON__('Can\'t call method "insert" on an
undefined value at /home/su...') called at
/home/sung/perl5/lib/perl5/Try/Tiny.pm line 100
	Try::Tiny::try('CODE(0xa780550)', 'Try::Tiny::Catch=REF(0xa847900)',
'Try::Tiny::Finally=REF(0xa6298f0)') called at
/home/sung/perl5/lib/perl5/DBIx/Class/Storage.pm line 258
	DBIx::Class::Storage::txn_do('undef', 'undef') called at
/home/sung/perl5/lib/perl5/DBIx/Class/Storage/DBI.pm line 807
'CODE(0xa7f98b0)') called at
/home/sung/perl5/lib/perl5/DBIx/Class/Schema.pm line 660
'CODE(0xa7f98b0)') called at
line 87
called at /home/sung/perl5/lib/perl5/HTML/FormHandler.pm line 296
'item', 'Nectar::WebV2::Model::NECTAR::User=HASH(0xa18ed70)',
'params', 'HASH(0xa19f2e0)', 'schema',
'Nectar::Schema::NECTAR=HASH(0x7e90250)') called at
line 83
'Nectar::WebV2=HASH(0xa0e9840)') called at
/home/sung/perl5/lib/perl5/Catalyst/Action.pm line 65
'Nectar::WebV2=HASH(0xa0e9840)') called at
/home/sung/perl5/lib/perl5/Catalyst.pm line 1667
	eval {...} called at /home/sung/perl5/lib/perl5/Catalyst.pm line 1667

The Controller::Auth::register looks like:

    use Nectar::Form::Register;
    my $form = Nectar::Form::Register->new;

    # Stash the form and the template to render it
    $c->stash(template => 'Form/register.tt2', form=> $form);

    # Create an empty row object for the desired table
    my $new_user= $c->model("NECTAR::User")->new_result( {} );

    # Process the form with the parameters, a schema and a row object
        item   => $new_user,
        params => $c->request->parameters,
        schema => $c->model("NECTAR")->schema,

You may find that there's 'schema' attribute within the process, which
you might think it's irrelevant here.
However if I delete it (e.g. only 'item' and 'params' as per manual),
I got an error shown below:

Caught exception in Nectar::WebV2::Controller::Auth->register "Can't
call method "_count_select" on an undefined value at
/home/sung/perl5/lib/perl5/DBIx/Class/ResultSet.pm line 1494."

My app is based on:
Catalyst 5.90007
DBIx::Class 0.08196
HTML::FormHandler 0.36003
Perl v5.8.8
Linux version 2.6.18-274.17.1.el5.centos.plus
(mockbuild at builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat

Just to add up, installation of HTML::FormHandler failed via cpanm:

Perl v5.10.0 required--this is only v5.8.8, stopped at
line 9.
BEGIN failed--compilation aborted at
line 9.
Compilation failed in require at t/config.t line 13.
BEGIN failed--compilation aborted at t/config.t line 13.
Test Summary Report
t/config.t                 (Wstat: 2304 Tests: 0 Failed: 0)
  Non-zero exit status: 9
  Parse errors: No plan found in TAP output
Files=59, Tests=1145, 96 wallclock secs ( 0.27 usr  0.09 sys + 88.52
cusr  3.05 csys = 91.93 CPU)
Result: FAIL
Failed 1/59 test programs. 0/1145 subtests failed.
make: *** [test_dynamic] Error 255
-> FAIL Installing HTML::FormHandler failed. See
/home/sung/.cpanm/build.log for details.

Any thoughts?


More information about the Catalyst mailing list