Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: redirection without CGI.pm

by arturo (Vicar)
on Sep 14, 2001 at 23:07 UTC ( [id://112503]=note: print w/replies, xml ) Need Help??


in reply to redirection without CGI.pm

You'd use Javascript, or some other technology that embeds program instructions in HTML code. Perl can't, in general, be used *within* an HTML page without a special framework far more complex to set up than using CGI.pm. But assuming that what you seek is information on how you would write a script that would accept output from an HTML form and redirect the user's browser based on that output, you *should* use CGI.pm to gather that information, or failing that, CGI::Lite. Unless you have some very good reason for not wanting to use CGI.pm ?

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Replies are listed 'Best First'.
Re: Re: redirection without CGI.pm
by Jerry (Scribe) on Sep 15, 2001 at 00:45 UTC
    I'm sure the gods of complete http headers will strike me for this one, but in a quick and dirty situation, this should function:

    As your first print statement send:

    print "Location: http://www.redirect.me/here\n\n";
    As I said before, this returns incomplete HTTP headers, however it should provide the desired function in an emergency situation.

    Heres an example (redirects you to yahoo):
    http://www.jerryfowler.net/redirect.cgi

    And here's the code:

    #!/usr/bin/perl print "Location: http://www.yahoo.com\n\n";
    -Jerry
    http://www.digilliance.net

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found