in reply to Re: URI plus File::Spec::Unix -- good idea or bad?
in thread URI plus File::Spec::Unix -- good idea or bad?

of course, but my goal is to avoid the "if the $uri->path doesn't end in a slash do something different" part, if possible.
$uri->path( $uri->path =~ m{/$} ? $uri->path . 'index.html' : $uri->pa +th . '/index.html')
and similar seems more clumsy.

what i actually end up with is typically more like $base .= '/' unless $base =~ m{/$};, but i'm looking for something smarter, because i hate repeating these things and the problem is so easily solved (use File::Spec) with other file paths outside of URI context.

as for localization, that's why i used File::Spec::Unix explicitly, because you are correct, i don't need localization magic.

Replies are listed 'Best First'.
Re^3: URI plus File::Spec::Unix -- good idea or bad?
by duckyd (Hermit) on Aug 24, 2006 at 22:31 UTC
    Slightly less clumsy?
    $uri->path( $uri->path .( $uri->path =~ m{/$} ? '' : '/' ) .'index.html' );