use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# vX.Y.Z: X YYYZZZ
-$VERSION = 1.000001;
+$VERSION = 1.000002;
@ISA = qw(Exporter);
@EXPORT = ();
-@EXPORT_OK = qw(readdatafile writedatafile);
+@EXPORT_OK = qw(readdatafile writedatafile join_path);
%EXPORT_TAGS = ();
##################
}
+
+# join_path() builds a path (or url) from individual segments
+# that there will be 1 path separator brtween (and not 2 or 0).
+sub join_path {
+ (my $joiner, my @segments) = @_;
+
+ my $path = '';
+ foreach my $segment (@segments) {
+ if ($path eq '') {
+ $path = $segment;
+ }
+ else {
+ unless (substr ($path, -1) eq $joiner) {
+ $path .= $joiner;
+ }
+ if (substr ($segment, 0, 1) eq $joiner) {
+ $path = $segment;
+ }
+ else {
+ $path .= $segment;
+ }
+ }
+ }
+ return $path;
+}
1