This isn't a bug in CGI::PathInfo. The web browser resolves '../' path
segments itself and so if using '/' as a path separator the web browser
believes the current base directory is deeper. The only workaround to
allow relative links to work I can think of while keeping '/' as the tuple
separator is to use a consistent # of '/' levels (padding if needed).
Alternatively you can use schemeless URLs: //files/css/main.css if
site-relative URLs are sufficient to your need.
You can also change the parameter tuple SplitOn character to something
other than the default '/', that should let you avoid the path
interpretation by the browser entirely.
On Thu, 11 May 2017, Lady Aleena via RT wrote:
Show quoted text> Thu May 11 18:03:26 2017: Request 121625 was acted upon.
> Transaction: Ticket created by ALEENA
> Queue: CGI-PathInfo
> Subject: Relative paths not resolved correctly
> Broken in: (no value)
> Severity: Important
> Owner: Nobody
> Requestors: ALEENA@cpan.org
> Status: new
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=121625 >
>
>
> I was testing this and found my relative paths were not resolved correctly such as the paths to my style sheets. So, when I use this, the style sheets are not loaded because the relative path is wrong.
>
> Let's say I have a script in Directory1/Directory2/script.pl. The relative path to my style sheets is ../../files/css/main.css. When using this, the new path is Directory1/Directory2/script.pl/opt-Selected. The new relative path to my style sheets should be ../../../files/css/main.css.
>
> I have the option of dropping relative paths, but that is not preferred. I would have to make all relative links on my site absolute. That has bitten me on more than one occasion.
>
> Also, if I could get the Eq option to work and change the - to a /, the relative path would be another level deeper, unless there is a way to not have the parameter name not show up. However, right now, I can't use this because of the problem resolving relative links to files like my style sheets.
>