[Catalyst] Moose attributes not initializing when including
FormHandler form
Rippl, Steve
rippls at woodlandschools.org
Tue Jan 3 23:56:35 GMT 2012
I don't know if this is a Moose, FormHandler or Catalyst problem, so I'm
starting here, hope that's OK! I have an existing App that I'm just
starting to convert over to using FormHandler from FormFu, and so far I've
only done that for one controller's forms, others still employ FormFu.
Here's the top of the controller which has switched...
package WsdSis::Controller::LearningPlan;
use Moose;
use namespace::autoclean;
use 5.010;
BEGIN {extends 'Catalyst::Controller' }
use WsdSis::Form::LearningPlan::Start;
...
Now I have another controller that builds some per context Moose objects to
create categories/reports and when I hit those now (not touching
WsdSis::Controller::LearningPlan except on startup) I'm getting
Caught exception in WsdSis::Controller::Reports->data "Can't use an
undefined value as a HASH reference at
/srv/WsdSis/script/../lib/WsdSis/Model/Categories/CategoryList.pm line 88."
referring to
88: $self->_temp_details->{$category} =3D {
89: type_id =3D> $datatype_id,
90: };
and yet defined at the top of WsdSis::Model::Categories::CategoryList is
package WsdSis::Model::Categories::CategoryList;
use Moose;
use Moose::Util::TypeConstraints;
with qw( MooseX::Traits WsdSis::Model::Categories::Roles::GetData );
use Data::Dumper;
use namespace::autoclean;
has 'ctx' =3D> (
is =3D> 'rw',
required =3D> 1,
);
has 'list' =3D> (
is =3D> 'ro',
required =3D> 1,
isa =3D> 'ArrayRef',
);
has 'student_data_store' =3D> (
is =3D> 'ro',
isa =3D> 'HashRef',
);
has details =3D> (
is =3D> 'rw',
isa =3D> 'HashRef',
builder =3D> '_build_details',
);
has _temp_details =3D> (
is =3D> 'rw',
isa =3D> 'HashRef',
default =3D> sub{ {} },
);
So _temp_details has a default which is first called upon
in _build_details. All this works fine if I comment out the
use WsdSis::Form::LearningPlan::Start;
in WsdSis::Controller::LearningPlan!!
What am I doing wrong? Why isn't $self->_temp_details being initialized
when I use an HTML::FormHandler form package in a different controller?
Thanks,
Steve
-- =
Steve Rippl
Technology Director
Woodland Public Schools
360 841 2730
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120103/de28d=
8de/attachment.htm
More information about the Catalyst
mailing list