sub normalizedPath { my ($path, $sep, $doSlashes, $beURLaware) = @_; # URLawareness means that m{[a-z]+//:} will be skipped # if ($beURLaware) then exclude the double slashed url-qualifier if ($doSlashes) { if ($beURLaware) { my ($type, $protocol, $urlPath) = ($path =~ m{(([a-z]+:)?//)?(.*)}o); $urlPath =~ s{/+}{/}go; $path = $type.$urlPath; # $path = ($protocol ne ''? $protocol: 'http:')."//$urlPath"; # if ($beURLaware) { # my ($type, $urlPath) = ($path =~ m{([a-z]+://)?(.*)}o); # $urlPath =~ s{/+}{/}go, $path = $type.$urlPath; } else { $path=~s{/+}{/}go; } #mult slashes are like single slashes } # . elimination before .. dt .. must ignore any . # eliminate . components: here seems to be some bug $path=~s{(^|/)\./}{\1}og; #g option is safe here (dt limited scope) # Line below gives warning while ($path=~s{(^|/)[^/]*/\.\./}{\1}o) {} # suceeding '..' prevent g option # Line above gives Warning return $path; }