in reply to Can't call method "model" on an undefined value at

Perl tries telling you that $c is not defined

Try to find out why.

update

please provide correct informations if you want us to help you:

->mode is not ->model !

Cheers Rolf

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Can't call method "model" on an undefined value at
by phildeman (Scribe) on Jan 09, 2015 at 15:20 UTC

    That was a typo. It should have read, $c->model. However, it is typed correctly in the app.

    Below is a snippet of code from Root.pm
    sub myform :Local {
       my ($self, $c) = @_;
       my $model = $c->model( 'mypackage' );
       my $results = $model->get_my_results();
       .
       .
       .
    }

      Obviously myform was not called passing a correct $c

      So please show us the call ....

      I could imagine someone forgot calling it as a ->method hence messing up $self.

      update

      Using Carp::Always might help...

      Cheers Rolf

      PS: Je suis Charlie!

        That is correct. I found the evil doings of my script. I forgot to pass $c from the calling method. Therefore, myform did not have anything in $c. It's now resolved.

        Thanks for your help and patience.