From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

# VOODOO LINE-NOISE
my($C,$M,$P,$N,$S);END{print"1..$C\n$M";print"\nfailed: $N\n"if$N}
sub ok{$C++; $M.= ($_[0]||!@_)?"ok $C\n":($N++,"not ok $C (".
((caller 1)[1]||(caller 0)[1]).":".((caller 1)[2]||(caller 0)[2]).")\n")}
sub try{$P=qr/^$_[0]$/}sub fail{ok($S=$_[0]!~$P)}sub pass{ok($S=$_[0]=~$P)}
# LOAD
ok;
# TEST URIs
try $RE{URI}{FTP};
# Test "safe" chars.
# Test "extra" chars.
pass "ftp://ftp.example.com/**!(),,''";
# Test URI additional chars.
# Should fail on ';'.
# Usernames/passwords are allowed in ftp URIs.
# ~ was NOT allowed by RFC 1738, but currently is.
pass 'ftp://ftp.example.com/~abigail/';
# Fail on "national" characters.
# Fail on "punctation" characters.
# Cannot have queries.
# Test type.
# Scheme must be lower case, and correct.
try $RE{URI}{FTP}{-password};
# Test "safe" chars.
# Test "extra" chars.
pass "ftp://ftp.example.com/**!(),,''";
# Test URI additional chars.
# Should fail on ';'.
# Usernames/passwords are allowed in ftp URIs.
# ~ was NOT allowed by RFC 1738, but currently is.
pass 'ftp://ftp.example.com/~abigail/';
# Fail on "national" characters.
# Fail on "punctation" characters.
# Cannot have queries.
# Test type.
# Scheme must be lower case, and correct.
try $RE{URI}{FTP}{"-type" => "[AIDaid]"};
# Test "safe" chars.
# Test "extra" chars.
pass "ftp://ftp.example.com/**!(),,''";
# Test URI additional chars.
# Should fail on ';'.
# Usernames/passwords are allowed in ftp URIs.
# ~ was NOT allowed by RFC 1738, but currently is.
pass 'ftp://ftp.example.com/~abigail/';
# Fail on "national" characters.
# Fail on "punctation" characters.
# Cannot have queries.
# Test type.
# Scheme must be lower case, and correct.