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

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();
   .
   .
   .
}

Replies are listed 'Best First'.
Re^3: Can't call method "model" on an undefined value at
by LanX (Saint) on Jan 09, 2015 at 15:32 UTC
    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.