He expects http://a.b.c/d/../e/ to be the same as http://a.b.c/e/.
use strict;
use warnings;
use Test::More tests => 1;
use URI qw( );
my $base1 = URI->new("http://a.b.c/d/../e/");
my $base2 = URI->new_abs("../e/", URI->new("http://a.b.c/d/"));
my $uri = URI->new("http://a.b.c/y");
is($uri->rel($base1), $uri->rel($base2));
1;
1..1
not ok 1
# Failed test at a.pl line 12.
# got: '../../../y'
# expected: '../y'
# Looks like you failed 1 test of 1.
I don't see anything in http://cpansearch.perl.org/src/GAAS/URI-1.58/t/abs.t that covers this case.
The equality definitely doesn't hold up in file systems (due to links both soft and hard), but ../../../y is much less likely to be correct.
Update: Improved test a bit.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|