From PHP to Perl


Redirect

Posted in Other by gosukiwi on December 6, 2006

Well, i think you all know how to redirect in PHP (header(‘Location: page.php’)) but, in perl, you have to set the header before the input, and what if you always include a header file, print the content, and then a footer file, or use some kind of “PHP” Navigation, including files?
Well, there is one way to do this, “Javascript”
You can redirect with Javascript from Perl!

First, you need to make a basic JS Code

function redirect(time, url)
{
$seconds = time*1000;
$url = url;
setTimeout(“window.location=$url”,$seconds);
}

That will redirect in x seconds, to an x url
And, for some Perl integration, i made this simple function

sub redirect
{
print ‘<script language=”javascript” type=”text/javascript”>redirect(‘.$_[0].’,\”.$_[1].’\’)</script>’;
}

And thats all! Now, when you want to redirect, just make

redirect(1,’mypage.pl’);

Thats the equivalent of PHP’s

header(‘refresh: 1; url=mypage.php’);

Well, i hope you find this useful :] Bye!

Advertisements

11 Responses to 'Redirect'

Subscribe to comments with RSS or TrackBack to 'Redirect'.


  1. I simply could not leave your site before suggesting that I
    actually loved the usual information an individual supply on your
    guests? Is gonna be again continuously to check out
    new posts

  2. kettensage said,

    I think the admin of this website is really working hard in suppport of his website, as here every data is quaality based data.

  3. inpore.us said,

    Outbreaks are commonly accompanied by pain, itching, or burning.
    Patients with symptomatic or asymptomatic recurrences can transmit infection to
    sexual partners. Bacterial Vaginosis (BV) on the other hand is as a result of bad bacterial such as haemophilus vaginitis growing at rate that the body’s immune system can’t keep in check.

  4. Dollie said,

    Boom Beach joins the ranks of being Supercell’s latest game released after their success with Clash of Clans
    and Hay Day. When you are building villages in the Clash of Clans, we would
    strongly recommend you to use the basics of urban planning in order to
    build a tightly spaced property. The majority of games include audio sections in their menus.


  5. So you please tolerate a few grammar and syntax problems as you
    read this. When you are building villages in the Clash of Clans, we would strongly recommend you to use the basics of urban planning in order to build a tightly spaced property.
    One resents the older family member forcing their opinion on the younger sibling.

  6. Veronica said,

    Outbreaks are commonly accompanied by pain, itching,
    or burning. By having a weak immune system, you are at
    risk of having an outbreak. Most women do not feel comfortable talking about problems down below even with their doctors.

  7. Liam said,

    There are lots of natural remedies that have been found
    to be very effective and some of these are even prescribed
    by doctors as a way of treating this condition. Patients with symptomatic or asymptomatic recurrences can transmit infection to
    sexual partners. First, this helps boost your immune system
    giving you greater resistance to viral type illnesses.

  8. Oleavia.org said,

    You shouldn’t buy a game if you are not sure whether you are going to like it.

    If your children want to access a site where their friends
    are playing, look at the site first. In addition, the top players in the top three clans receive gems from the weekly tournament.


  9. There are lots of natural remedies that have been found
    to be very effective and some of these are even prescribed by doctors as a way of treating this condition. A doctor should try as many different pills, creams and ointments as
    he or she can before finding the correct one. However –
    the thing is – this girl had been cured – by something – which demonstrates that healing is possible.


  10. Great blog you have here but I was curious about if you knew of any message boards that cover the same topics talked about here?
    I’d really like to be a part of community where I can get opinions from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know.
    Thank you!

  11. Loola said,

    magnificent submit, very informative. I
    wonder why the opposite specialists of this sector do not realize this.
    You should proceed your writing. I am sure, you
    have a huge readers’ base already!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: