ck_net_2004
04-24-2011, 02:38 AM
First up I know next to nothing about Perl, im a PHP person when it comes to webdevelopment. So i'm hoping someone here is willing to help me with this basic script.
Basicly I want to redirect the person to the new system based on the page ID of the item they went to.
I'm used to GET variables, but this old system was a tad different as it had the ID number as the last part of the URL without any ? beforehand.
an example of such a URL:
cgi-bin/cms/Item/01234
I went and found a basic redirection script from the internet, and what I want to do first is modify it to get the full URL of the script (using the environment variable SCRIPT_PATH perhaps?), split it up by the forward slashes, and if the seccond-last one equals "Item", then the last one will equal the ID i'm after.
Once I have the ID from the old system, I need to reference a hashtable/array to see what the new ID is on the new system. Again I have no idea how to write a hashtable in Perl.
Once I have those two things I can just redirect to the new page.
Heres the redirect I grabbed off the internet:
#!/usr/bin/perl
#
# fixedredir.cgi
use strict;
use warnings;
my $URL = "http://www.example.com/";
print "Status: 302 Moved\nLocation: $URL\n\n";
I feel guilty asking for someone to code it completely for me, but I really don't know Perl at all, and im sure for someone who knows it inside out this would take 30secconds.
Cheers for any help/links people can provide.
Regards Chris
Basicly I want to redirect the person to the new system based on the page ID of the item they went to.
I'm used to GET variables, but this old system was a tad different as it had the ID number as the last part of the URL without any ? beforehand.
an example of such a URL:
cgi-bin/cms/Item/01234
I went and found a basic redirection script from the internet, and what I want to do first is modify it to get the full URL of the script (using the environment variable SCRIPT_PATH perhaps?), split it up by the forward slashes, and if the seccond-last one equals "Item", then the last one will equal the ID i'm after.
Once I have the ID from the old system, I need to reference a hashtable/array to see what the new ID is on the new system. Again I have no idea how to write a hashtable in Perl.
Once I have those two things I can just redirect to the new page.
Heres the redirect I grabbed off the internet:
#!/usr/bin/perl
#
# fixedredir.cgi
use strict;
use warnings;
my $URL = "http://www.example.com/";
print "Status: 302 Moved\nLocation: $URL\n\n";
I feel guilty asking for someone to code it completely for me, but I really don't know Perl at all, and im sure for someone who knows it inside out this would take 30secconds.
Cheers for any help/links people can provide.
Regards Chris