[Catalyst] Testing View

Yao Wang S3115360 at student.rmit.edu.au
Thu Apr 17 05:56:49 BST 2008

Dear Friends,

I have just started working on a project using Catalyst. I am trying my hand at testing and got the following issue :(

I have created the following test file:

my $c = MyApp -> prepare();

MyApp::Controller::MyController::MyAction(undef, $c);

ok($c->stash->{template} eq $expected_template_name, "comparing template returned");

Now, all seemed to work fine till i realized that its better to explicitly
forward $c to MyApp::View::TT rather than doing in the end method. But after adding this line to my controller action i got this error:

"Modification of non-creatable array value attempted, subscript -1 at
/usr/lib/perl5/vendor_perl/5.8.8/Catalyst/Dispatcher.pm line 186."

I guess this is happening because $c->stash->template does not exist anymore?

Any way to get around this problem.

Thanks a lot,
Gaurav Talwar 

More information about the Catalyst mailing list