✏️ 编辑:_userpass.pm
路径:
/usr/local/share/perl5/5.32/URI/_userpass.pm
大小:1.18 KB · 修改:2026-09-03 22:49:40 · 权限:0444 · 只读(保存会失败)
← 返回目录
👁 查看
⬇ 下载
package URI::_userpass; use strict; use warnings; use URI::Escape qw(uri_unescape); our $VERSION = '5.37'; sub user { my $self = shift; my $info = $self->userinfo; if (@_) { my $new = shift; my $pass = defined($info) ? $info : ""; $pass =~ s/^[^:]*//; if (!defined($new) && !length($pass)) { $self->userinfo(undef); } else { $new = "" unless defined($new); $new =~ s/%/%25/g; $new =~ s/:/%3A/g; $self->userinfo("$new$pass"); } } return undef unless defined $info; $info =~ s/:.*//; uri_unescape($info); } sub password { my $self = shift; my $info = $self->userinfo; if (@_) { my $new = shift; my $user = defined($info) ? $info : ""; $user =~ s/:.*//; if (!defined($new)) { $self->userinfo(length $user ? $user : undef); } else { $new = "" unless defined($new); $new =~ s/%/%25/g; $self->userinfo("$user:$new"); } } return undef unless defined $info; return undef unless $info =~ s/^[^:]*://; uri_unescape($info); } 1;
💾 保存
取消
保存为 UTF-8,换行统一为 LF