X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Fliburi-perl%2Fliburi-perl-1.35.dfsg.1%2FURI%2Ffile%2FBase.pm;fp=dev%2Farm%2Fliburi-perl%2Fliburi-perl-1.35.dfsg.1%2FURI%2Ffile%2FBase.pm;h=51030c222d4d3bf896795d622b1eea004d7a9149;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/liburi-perl/liburi-perl-1.35.dfsg.1/URI/file/Base.pm b/dev/arm/liburi-perl/liburi-perl-1.35.dfsg.1/URI/file/Base.pm new file mode 100644 index 0000000..51030c2 --- /dev/null +++ b/dev/arm/liburi-perl/liburi-perl-1.35.dfsg.1/URI/file/Base.pm @@ -0,0 +1,80 @@ +package URI::file::Base; + +use strict; +use URI::Escape qw(); + +sub new +{ + my $class = shift; + my $path = shift; + $path = "" unless defined $path; + + my($auth, $escaped_auth, $escaped_path); + + ($auth, $escaped_auth) = $class->_file_extract_authority($path); + ($path, $escaped_path) = $class->_file_extract_path($path); + + if (defined $auth) { + $auth =~ s,%,%25,g unless $escaped_auth; + $auth =~ s,([/?\#]),$URI::Escape::escapes{$1},g; + $auth = "//$auth"; + if (defined $path) { + $path = "/$path" unless substr($path, 0, 1) eq "/"; + } else { + $path = ""; + } + } else { + return undef unless defined $path; + $auth = ""; + } + + $path =~ s,([%;?]),$URI::Escape::escapes{$1},g unless $escaped_path; + $path =~ s/\#/%23/g; + + my $uri = $auth . $path; + $uri = "file:$uri" if substr($uri, 0, 1) eq "/"; + + URI->new($uri, "file"); +} + +sub _file_extract_authority +{ + my($class, $path) = @_; + return undef unless $class->_file_is_absolute($path); + return $URI::file::DEFAULT_AUTHORITY; +} + +sub _file_extract_path +{ + return undef; +} + +sub _file_is_absolute +{ + return 0; +} + +sub _file_is_localhost +{ + shift; # class + my $host = lc(shift); + return 1 if $host eq "localhost"; + eval { + require Net::Domain; + lc(Net::Domain::hostfqdn()) eq $host || + lc(Net::Domain::hostname()) eq $host; + }; +} + +sub file +{ + undef; +} + +sub dir +{ + my $self = shift; + $self->file(@_); +} + +1;