newlocal.al

来自「ARM上的如果你对底层感兴趣」· AL 代码 · 共 30 行

AL
30
字号
# NOTE: Derived from blib\lib\URI\URL\file.pm.
# Changes made here will be lost when autosplit again.
# See AutoSplit.pm.
package URI::URL::file;

#line 55 "blib\lib\URI\URL\file.pm (autosplit into blib\lib\auto/URI\URL\file/newlocal.al)"
sub newlocal {
    my($class, $path) = @_;

    Carp::croak("Only implemented for Unix and OS/2 file systems")
      unless $ostype eq "unix" or $^O =~ /os2|mswin32/i;
    # XXX: Should implement the same thing for other systems

    my $url = new URI::URL "file:";
    unless (defined $path and
    	    ($path =~ m:^/: or 
	     ($^O eq 'os2' and Cwd::sys_is_absolute($path)) or
	     ($^O eq 'MSWin32' and $path =~ m<^[A-Za-z]:[\\/]|^[\\/]{2}>))) {
	require Cwd;
	my $cwd = Cwd::fastcwd();
	$cwd =~ s:/?$:/:; # force trailing slash on dir
	$path = (defined $path) ? $cwd . $path : $cwd;
    }
    $url->path($path);
    $url;
}

# end of URI::URL::file::newlocal
1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?