Solved

Absolutizing urls..

Posted on 2006-11-07
2
264 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 500 total points
ID: 17892740
0
 
LVL 11

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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

726 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