http://www.perlmonks.org?node_id=178496


in reply to Re: Re: cgi page not showing
in thread cgi page not showing

Well, as I said, you cannot call an object method if the object does not exist and its values aren't set, so simply try this instead :-)
my $cgi = new CGI; # get the User my $user = new GWAK::User(); # did it work ? if (!$user) { # if not go to login page print $cgi->redirect("insert your login_url"); } else { # or proceed print $cgi->header(); ... }
caedes is right, since you once write a header you cannot write a second one, but in my experience a mistakenly written second header would then just occur as plain text, but that might differ depending on the default mime-type setting of the webserver.

Have a nice day
All decision is left to your taste

Replies are listed 'Best First'.
Re: Re: Re: Re: cgi page not showing
by amphiplex (Monk) on Jul 01, 2002 at 09:25 UTC
    He doesn't call the object method $user->redirect_to_login, but the subroutine GWAK::User->redirect_to_login which should work even when the creation of the $user object failed.

    Aside from this, it would be very helpful if the relevant parts of the GWAK module were provided here.

    ---- kurt
      Correct, but then he is using the method 'errstr' which I guess should return an error string, which must fail, cause it was not populated with a value. So at least it could return 'undef', does it?

      Have a nice day
      All decision is left to your taste