in reply to Converting relative URLs to absolute URLs
#!/usr/bin/perl use strict; use URI::URL; use constant BASE => 'http://www.pair.com/pair/support/index.html'; print "BASE is ", BASE, "\n\n"; while ( chomp(my $path = <DATA>) ) { &tryit( $path ); } sub tryit { my $relative = shift; my $path = URI::URL->new($relative)->abs( BASE, 1 ); print "$relative ->\n\t$path\n\n"; } __DATA__ http://www.pair.com /index.html https://www.pairnic.com/faq.m search/ library.html
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Converting relative URLs to absolute URLs
by Anonymous Monk on Mar 05, 2004 at 03:38 UTC | |
by esskar (Deacon) on Mar 05, 2004 at 03:46 UTC | |
by mkurtis (Scribe) on Mar 05, 2004 at 04:12 UTC | |
by esskar (Deacon) on Mar 05, 2004 at 20:37 UTC | |
by mkurtis (Scribe) on Mar 06, 2004 at 02:32 UTC |