I am trying to get a mechaism that does the following..

With relative urls:

I.E: At <http://www.domain.com/sub1/sub2/sub3/page.htm>
the url <../../page.htm> refers to
<http://www.domain.com/page.htm>

so my URL, after:

--SNIP--

#Get page
 my $res = $ua->request(HTTP::Request->new(GET => $starting_url), sub
{$link_extor->parse($_[0])});

#Note that pages are put in @links by callback function by HTML::LinkExtor

  # Expand all image URLs to absolute ones
  my $base = $res->base;
@links = map { $_ = url($_, $base)->abs; } @links;

--SNIP--

Looks like <current_url>../../page.htm. Like
<http://www.domain.com/page1/page2/page3/../../page.htm>

The code:

$element =~ s|\.\./||;

Will remove all the "../". I just need to trim the extra page3/ rubbish
depending on the amount of ../s.
Could you point me in the direction of something that will do this. Perhaps
a regexp, though if you
are including one, could you please provide a description of what it does
for me..

Cheers,
Lorne



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to