Changeset 16203
- Timestamp:
- Jan 23, 2008, 12:27:51 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
-
Nebulous-Server/Build.PL (modified) (1 diff)
-
Nebulous-Server/Changes (modified) (1 diff)
-
Nebulous-Server/MANIFEST (modified) (1 diff)
-
Nebulous-Server/t/75_parse_neb_key.t (added)
-
Nebulous/Build.PL (modified) (1 diff)
-
Nebulous/Changes (modified) (1 diff)
-
Nebulous/MANIFEST (modified) (1 diff)
-
Nebulous/lib/Nebulous/Util.pm (modified) (4 diffs)
-
Nebulous/t/75_parse_neb_key.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Build.PL
r13388 r16203 80 80 create_makefile_pl => 'passthrough', 81 81 requires => { 82 'Class::Accessor::Fast' => 0, 82 83 'Config::YAML' => '1.42', 84 'DBD::mysql' => '3.0007', 85 'DBI' => '1.53', 86 'File::ExtAttr' => '1.03', 87 'File::Spec::Functions' => 0, 88 'Log::Log4perl' => '0.48', 89 'Net::Server::Daemonize'=> '0.05', 90 'Params::Validate' => '0.73', 91 'SOAP::Lite' => '0.69', 92 'Sys::Statistics::Linux::DiskUsage' => '0.02', 83 93 'URI' => '1.30', 84 'SOAP::Lite' => '0.69',85 'Log::Log4perl' => '0.48',86 'DBI' => '1.53',87 'DBD::mysql' => '3.0007',88 'Class::Accessor::Fast' => 0,89 'Params::Validate' => '0.73',90 'Net::Server::Daemonize'=> '0.05',91 'Sys::Statistics::Linux::DiskUsage' => '0.02',92 'File::ExtAttr' => '1.03',93 94 }, 94 95 build_requires => { -
trunk/Nebulous-Server/Changes
r16183 r16203 2 2 3 3 0.06 4 - add Nebulous::Util::parse_neb_key() 4 5 - change bin/* scripts to conistently use --volume instead of --node, 5 6 etc. -
trunk/Nebulous-Server/MANIFEST
r16183 r16203 110 110 t/63_client_stat.t 111 111 t/64_client_find_objects.t 112 t/75_parse_neb_key.t 112 113 t/90_nebclient.t 113 114 t/TEST.PL -
trunk/Nebulous/Build.PL
r13388 r16203 80 80 create_makefile_pl => 'passthrough', 81 81 requires => { 82 'Class::Accessor::Fast' => 0, 82 83 'Config::YAML' => '1.42', 84 'DBD::mysql' => '3.0007', 85 'DBI' => '1.53', 86 'File::ExtAttr' => '1.03', 87 'File::Spec::Functions' => 0, 88 'Log::Log4perl' => '0.48', 89 'Net::Server::Daemonize'=> '0.05', 90 'Params::Validate' => '0.73', 91 'SOAP::Lite' => '0.69', 92 'Sys::Statistics::Linux::DiskUsage' => '0.02', 83 93 'URI' => '1.30', 84 'SOAP::Lite' => '0.69',85 'Log::Log4perl' => '0.48',86 'DBI' => '1.53',87 'DBD::mysql' => '3.0007',88 'Class::Accessor::Fast' => 0,89 'Params::Validate' => '0.73',90 'Net::Server::Daemonize'=> '0.05',91 'Sys::Statistics::Linux::DiskUsage' => '0.02',92 'File::ExtAttr' => '1.03',93 94 }, 94 95 build_requires => { -
trunk/Nebulous/Changes
r16183 r16203 2 2 3 3 0.06 4 - add Nebulous::Util::parse_neb_key() 4 5 - change bin/* scripts to conistently use --volume instead of --node, 5 6 etc. -
trunk/Nebulous/MANIFEST
r16183 r16203 110 110 t/63_client_stat.t 111 111 t/64_client_find_objects.t 112 t/75_parse_neb_key.t 112 113 t/90_nebclient.t 113 114 t/TEST.PL -
trunk/Nebulous/lib/Nebulous/Util.pm
r13302 r16203 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Util.pm,v 1. 7 2007-05-08 02:27:42jhoblitt Exp $3 # $Id: Util.pm,v 1.8 2008-01-23 22:27:51 jhoblitt Exp $ 4 4 5 5 package Nebulous::Util; … … 12 12 use base qw( Exporter ); 13 13 14 use File::Spec::Functions; 14 15 use Log::Log4perl qw( :levels ); 15 16 use URI::file; … … 22 23 _get_filehandle 23 24 _open_uri 25 parse_neb_key 24 26 ); 25 27 … … 78 80 } 79 81 82 sub parse_neb_key 83 { 84 my $text = shift; 85 86 # white space is not allowed 87 if ($text =~ qr/\s+/) { 88 die "keys and URIs may not contain whitespace"; 89 } 90 91 my $uri = URI->new($text); 92 my $scheme = $uri->scheme; 93 my $path = $uri->opaque; 94 95 my $volume; 96 # if this is a valid uri 97 if (defined $scheme) { 98 # if so, does it use the neb scheme? 99 die "URI does not use the 'neb' scheme" 100 unless $scheme eq 'neb'; 101 102 # neb:path (not allowed) 103 # neb://<volume name>/... 104 # neb:/path... (leading '/' is stripped) 105 # neb:///path... (same as neb:/path) 106 107 # volume specifier must be at least one character 108 # strip off volume component if it exists 109 $path =~ s|^//([^/]+)||; 110 $volume = $1; 111 112 # require a leading slash if there is no volume name 113 if ((not defined $volume) and (not $path =~ m|^/|)) { 114 die "neb URI scheme requires a leading slash, eg. neb:/"; 115 } 116 } 117 118 # strip leading slashes 119 $path =~ s|^/+||; 120 121 # remove multiple /'s and trailing slashes 122 $path = canonpath($path); 123 124 return ($path, $volume); 125 } 126 80 127 1; 81 128
Note:
See TracChangeset
for help on using the changeset viewer.
