Brad Cathey wrote:
> Hello again,
> 
> I'm trying to understand exactly what postrun allows me to do.
> 
> I would like to have it set a new session (via C:P:A:Session) before the
> script outputs my .tmpl page. This code produces an error:
> 
> "Error executing class callback in postrun stage: Can't call method
> 'session' on an undefined value at..."
> 
> It may have nothing to do with my postrun, but I'm still curious.

It doesn't have anything to do with cgiapp_postrun() but rather how your calling
a subroutine.
[snip]

> sub cgiapp_postrun {
>     my $self = shift;
>     set_session(); 
> }

[snip]

> sub set_session {
>     my $self = shift;
>     $self->session->param(user_name   => $user_name);
>     $self->session->param(user_id     => $user_id);
>     $self->session->param(admin       => $admin);
>     $self->session->param(logged_in   => 1);
> }

Here you're calling set_session() but not passing any arguments to it. Then in
the set_session() sub your using 'shift' to pull out the arguments. So your
$self is undefined. You need to call set_session() like either of these 2 
examples:

  $self->set_session();
or
  set_session($self);

The first one is clearest since set_session() is clearly intended to be a 
method.

-- 
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to