?
Solved

Absolutizing urls..

Posted on 2006-11-07
2
Medium Priority
?
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

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

Expert Comment

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

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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 …
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…
Six Sigma Control Plans
Suggested Courses

752 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