IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17073 for trunk/Nebulous/lib


Ignore:
Timestamp:
Mar 20, 2008, 1:23:31 PM (18 years ago)
Author:
jhoblitt
Message:

server/client split

Location:
trunk/Nebulous/lib/Nebulous
Files:
3 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/lib/Nebulous/Client.pm

    r16302 r17073  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Client.pm,v 1.39 2008-02-05 04:57:56 eugene Exp $
     3# $Id: Client.pm,v 1.40 2008-03-20 23:21:58 jhoblitt Exp $
    44
    55package Nebulous::Client;
     
    88use warnings FATAL => qw( all );
    99
    10 our $VERSION = '0.02';
     10our $VERSION = '0.07';
    1111
    1212use File::Copy qw();
  • trunk/Nebulous/lib/Nebulous/Util.pm

    r16354 r17073  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Util.pm,v 1.10 2008-02-07 22:18:51 jhoblitt Exp $
     3# $Id: Util.pm,v 1.11 2008-03-20 23:21:58 jhoblitt Exp $
    44
    55package Nebulous::Util;
     
    8080}
    8181
    82 sub parse_neb_key
    83 {
    84     my $text = shift;
    85     return unless defined $text;
    86 
    87     # white space is not allowed
    88     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 uri
    98     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 character
    109         # strip off volume component if it exists
    110         $path =~ s|^//([^/]+)||;
    111         $volume = $1;
    112 
    113         # require a leading slash if there is no volume name
    114         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 slashes
    120     $path =~ s|^/+||;
    121 
    122     # remove multiple /'s and trailing slashes
    123     $path = canonpath($path);
    124 
    125     return ($volume, $path);
    126 }
    12782
    128831;
Note: See TracChangeset for help on using the changeset viewer.