Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: cgi page not showing

by jeff280679 (Initiate)
on Jul 01, 2002 at 08:54 UTC ( [id://178493]=note: print w/replies, xml ) Need Help??


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

I do have use CGI::Carp qw(fatalsToBrowser) and am using strict (of course:). But I get nothing.

What *should* happen is the when a new GWAK::User is created it authenticates using cookies, then fills a hash with user data and returns the reference. If it fails (bad auth, cannot access database..) it should call GWAK::User->redirect_to_login which is a class method which should just print a page which redirects to the login page.

The thing is, the call to new GWAK::User doesn't fail (it works if I remove the GWAK::User->redirect_to_login) but all that is sent to the browser is the HTTP headers. No error messages anywhere. It's like having the GWAK::User->redirect_to_login creates a black hole that the script does not come out of.

Replies are listed 'Best First'.
Re: Re: Re: cgi page not showing
by little (Curate) on Jul 01, 2002 at 09:14 UTC
    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
      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://178493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-24 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found