Solved

Absolutizing urls..

Posted on 2006-11-07
2
260 Views
Last Modified: 2012-06-21
Hi people,

I am trying to absolutize all urls.. but there is a prob. See example:

use URI::URL;

$url = "http://www.google.com/test";

I then put all links on $url, in an array: @pages. (i.e: all <a href="file.html"> tags)
So @pages = ("test.html","hi.html");

Then I try to absolutize all urls by doing:

@pages = map { $_ = url($_, $url)->abs; } @pages;

Then I print them by doing: print join("\n",@pages);

Then it gives:

http://www.google.com/test.html
http://www.google.com/hi.html

But.. it should have given:

http://www.google.com/test/test.html
http://www.google.com/test/hi.html

Any ideas?
0
Comment
Question by:TonyJix
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 17892740
0
 
LVL 11

Expert Comment

by:kblack05
ID: 17911122
Yes the trailing slash matters...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
use perl to insert into MySQL database 9 128
delete query using perl dbi 3 96
Perl Sort Question 4 129
collecting information 2 137
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now