background:
i have to deal with a lot of configuration variables for paths and URIs. these being entered by humans, there is no guarantee that the path|uri does or does not end with a slash.
solution?
for files, this is easy; use File::Spec:
use File::Spec;
my $filepath = File::Spec->catfile( $dir, $filename );
but what about URIs? i don't see any handy methods on the URI class for appending values. so i had an idea, i could use File::Spec::Unix to manipulate the path portion of the URI.
use File::Spec::Unix;
use URI;
my $uri = URI->new( $base );
$uri->path( File::Spec::Unix->catfile( $uri->path, 'foo.html' ) );
my question is, is this a good idea or bad idea? am i overlooking an existing best/common practice for dealing with this?