Changeset 17073 for trunk/Nebulous/lib
- Timestamp:
- Mar 20, 2008, 1:23:31 PM (18 years ago)
- Location:
- trunk/Nebulous/lib/Nebulous
- Files:
-
- 3 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/lib/Nebulous/Client.pm
r16302 r17073 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1. 39 2008-02-05 04:57:56 eugeneExp $3 # $Id: Client.pm,v 1.40 2008-03-20 23:21:58 jhoblitt Exp $ 4 4 5 5 package Nebulous::Client; … … 8 8 use warnings FATAL => qw( all ); 9 9 10 our $VERSION = '0.0 2';10 our $VERSION = '0.07'; 11 11 12 12 use File::Copy qw(); -
trunk/Nebulous/lib/Nebulous/Util.pm
r16354 r17073 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Util.pm,v 1.1 0 2008-02-07 22:18:51jhoblitt Exp $3 # $Id: Util.pm,v 1.11 2008-03-20 23:21:58 jhoblitt Exp $ 4 4 5 5 package Nebulous::Util; … … 80 80 } 81 81 82 sub parse_neb_key83 {84 my $text = shift;85 return unless defined $text;86 87 # white space is not allowed88 if ($text =~ qr/\s+/) {89 die "keys and URIs may not contain whitespace";90 }91 92 my $uri = URI->new($text);93 my $scheme = $uri->scheme;94 my $path = $uri->opaque;95 96 my $volume;97 # if this is a valid uri98 if (defined $scheme) {99 # if so, does it use the neb scheme?100 die "URI does not use the 'neb' scheme"101 unless $scheme eq 'neb';102 103 # neb:path (not allowed)104 # neb://<volume name>/...105 # neb:/path... (leading '/' is stripped)106 # neb:///path... (same as neb:/path)107 108 # volume specifier must be at least one character109 # strip off volume component if it exists110 $path =~ s|^//([^/]+)||;111 $volume = $1;112 113 # require a leading slash if there is no volume name114 if ((not defined $volume) and (not $path =~ m|^/|)) {115 die "neb URI scheme requires a leading slash, eg. neb:/";116 }117 }118 119 # strip leading slashes120 $path =~ s|^/+||;121 122 # remove multiple /'s and trailing slashes123 $path = canonpath($path);124 125 return ($volume, $path);126 }127 82 128 83 1;
Note:
See TracChangeset
for help on using the changeset viewer.
