From 294d9199f036dfb77811ed37e109524d67562a23 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 1 Jul 2014 19:18:33 -0700 Subject: use strict and warnings in all modules, tests and scripts --- URI.pm | 4 +++- URI/Escape.pm | 2 ++ URI/Heuristic.pm | 2 +- URI/IRI.pm | 1 + URI/QueryParam.pm | 1 + URI/Split.pm | 1 + URI/URL.pm | 7 ++++--- URI/WithBase.pm | 2 ++ URI/_foreign.pm | 7 +++++-- URI/_generic.pm | 9 ++++++--- URI/_idna.pm | 2 ++ URI/_ldap.pm | 1 + URI/_login.pm | 5 ++++- URI/_punycode.pm | 2 ++ URI/_query.pm | 4 +++- URI/_segment.pm | 2 ++ URI/_server.pm | 7 +++++-- URI/_userpass.pm | 2 ++ URI/data.pm | 9 +++++---- URI/file.pm | 1 + URI/file/Base.pm | 2 ++ URI/file/FAT.pm | 5 ++++- URI/file/Mac.pm | 6 ++++-- URI/file/OS2.pm | 5 ++++- URI/file/QNX.pm | 7 ++++--- URI/file/Unix.pm | 6 ++++-- URI/file/Win32.pm | 6 ++++-- URI/ftp.pm | 7 ++++--- URI/gopher.pm | 8 +++++--- URI/http.pm | 7 ++++--- URI/https.pm | 6 +++++- URI/ldap.pm | 1 + URI/ldapi.pm | 1 + URI/ldaps.pm | 6 +++++- URI/mailto.pm | 7 ++++--- URI/mms.pm | 5 ++++- URI/news.pm | 6 ++++-- URI/nntp.pm | 5 ++++- URI/pop.pm | 6 ++++-- URI/rlogin.pm | 6 +++++- URI/rsync.pm | 5 ++++- URI/rtsp.pm | 5 ++++- URI/rtspu.pm | 5 ++++- URI/sip.pm | 4 +++- URI/sips.pm | 6 +++++- URI/snews.pm | 5 ++++- URI/ssh.pm | 6 +++++- URI/telnet.pm | 6 +++++- URI/tn3270.pm | 6 +++++- URI/urn.pm | 6 ++++-- URI/urn/isbn.pm | 6 ++++-- URI/urn/oid.pm | 7 ++++--- t/abs.t | 8 ++++++-- t/clone.t | 4 +++- t/cwd.t | 3 +++ t/data.t | 7 +++++-- t/file.t | 15 +++++++++------ t/ftp.t | 4 +++- t/generic.t | 7 +++++-- t/gopher.t | 2 ++ t/heuristic.t | 3 +++ t/http.t | 9 ++++++--- t/idna.t | 2 ++ t/iri.t | 4 +++- t/ldap.t | 4 +++- t/mailto.t | 9 ++++++--- t/mix.t | 23 +++++++++++++---------- t/mms.t | 7 +++++-- t/news.t | 7 +++++-- t/num_eq.t | 1 + t/old-absconf.t | 5 ++++- t/old-base.t | 22 +++++++++++++--------- t/old-file.t | 17 ++++++++++------- t/old-relbase.t | 19 +++++++++++-------- t/pop.t | 5 ++++- t/punycode.t | 2 ++ t/query-param.t | 1 + t/query.t | 2 ++ t/rel.t | 4 +++- t/rfc2732.t | 2 ++ t/roy-test.t | 2 ++ t/rsync.t | 4 +++- t/rtsp.t | 7 +++++-- t/sip.t | 4 +++- t/split.t | 4 +++- t/storable-test.pl | 1 + t/storable.t | 3 +++ t/urn-isbn.t | 3 +++ t/urn-oid.t | 4 +++- uri-test | 3 +++ 90 files changed, 344 insertions(+), 135 deletions(-) diff --git a/URI.pm b/URI.pm index 1809ce2..4849eb5 100644 --- a/URI.pm +++ b/URI.pm @@ -1,6 +1,8 @@ package URI; use strict; +use warnings; + our $VERSION = "1.61"; our ($ABS_REMOTE_LEADING_DOTS, $ABS_ALLOW_RELATIVE_SCHEME, $DEFAULT_QUERY_FORM_DELIMITER); @@ -230,7 +232,7 @@ sub opaque $old_opaque; } -*path = \&opaque; # alias +sub path { goto &opaque } # alias sub fragment diff --git a/URI/Escape.pm b/URI/Escape.pm index e09d76a..fa0c707 100644 --- a/URI/Escape.pm +++ b/URI/Escape.pm @@ -1,5 +1,7 @@ package URI::Escape; + use strict; +use warnings; =head1 NAME diff --git a/URI/Heuristic.pm b/URI/Heuristic.pm index 360b483..c6cfea6 100644 --- a/URI/Heuristic.pm +++ b/URI/Heuristic.pm @@ -87,7 +87,7 @@ modify it under the same terms as Perl itself. =cut use strict; - +use warnings; require Exporter; *import = \&Exporter::import; diff --git a/URI/IRI.pm b/URI/IRI.pm index 4c0dadb..8ce5191 100644 --- a/URI/IRI.pm +++ b/URI/IRI.pm @@ -3,6 +3,7 @@ package URI::IRI; # Experimental use strict; +use warnings; use URI (); use overload '""' => sub { shift->as_string }; diff --git a/URI/QueryParam.pm b/URI/QueryParam.pm index c202fea..187cd2c 100644 --- a/URI/QueryParam.pm +++ b/URI/QueryParam.pm @@ -1,6 +1,7 @@ package URI::QueryParam; use strict; +use warnings; sub URI::_query::query_param { my $self = shift; diff --git a/URI/Split.pm b/URI/Split.pm index 9cfa322..693194b 100644 --- a/URI/Split.pm +++ b/URI/Split.pm @@ -1,6 +1,7 @@ package URI::Split; use strict; +use warnings; require Exporter; our @ISA = qw(Exporter); diff --git a/URI/URL.pm b/URI/URL.pm index 8225295..bfd5a72 100644 --- a/URI/URL.pm +++ b/URI/URL.pm @@ -1,9 +1,10 @@ package URI::URL; -require URI::WithBase; -@ISA=qw(URI::WithBase); - use strict; +use warnings; + +require URI::WithBase; +our @ISA=qw(URI::WithBase); our $VERSION = "5.04"; diff --git a/URI/WithBase.pm b/URI/WithBase.pm index 45b722b..1db3ff2 100644 --- a/URI/WithBase.pm +++ b/URI/WithBase.pm @@ -1,6 +1,8 @@ package URI::WithBase; use strict; +use warnings; + use URI; our $VERSION = "2.20"; diff --git a/URI/_foreign.pm b/URI/_foreign.pm index 075f0fd..261f4c9 100644 --- a/URI/_foreign.pm +++ b/URI/_foreign.pm @@ -1,6 +1,9 @@ package URI::_foreign; -require URI::_generic; -@ISA=qw(URI::_generic); +use strict; +use warnings; + +use URI::_generic; +our @ISA=qw(URI::_generic); 1; diff --git a/URI/_generic.pm b/URI/_generic.pm index d332756..f8834f2 100644 --- a/URI/_generic.pm +++ b/URI/_generic.pm @@ -1,9 +1,12 @@ package URI::_generic; -require URI; -require URI::_query; -@ISA=qw(URI URI::_query); use strict; +use warnings; + +use URI; +use URI::_query; +our @ISA=qw(URI URI::_query); + use URI::Escape qw(uri_unescape); use Carp (); diff --git a/URI/_idna.pm b/URI/_idna.pm index 8b9eab7..be0cccf 100644 --- a/URI/_idna.pm +++ b/URI/_idna.pm @@ -4,6 +4,8 @@ package URI::_idna; # based on Python-2.6.4/Lib/encodings/idna.py use strict; +use warnings; + use URI::_punycode qw(encode_punycode decode_punycode); use Carp qw(croak); diff --git a/URI/_ldap.pm b/URI/_ldap.pm index 1210a6d..1ee7558 100644 --- a/URI/_ldap.pm +++ b/URI/_ldap.pm @@ -5,6 +5,7 @@ package URI::_ldap; use strict; +use warnings; our $VERSION = "1.61"; diff --git a/URI/_login.pm b/URI/_login.pm index 4583f20..714cd51 100644 --- a/URI/_login.pm +++ b/URI/_login.pm @@ -1,8 +1,11 @@ package URI::_login; +use strict; +use warnings; + require URI::_server; require URI::_userpass; -@ISA = qw(URI::_server URI::_userpass); +our @ISA = qw(URI::_server URI::_userpass); # Generic terminal logins. This is used as a base class for 'telnet', # 'tn3270', and 'rlogin' URL schemes. diff --git a/URI/_punycode.pm b/URI/_punycode.pm index b53cc3c..0506181 100644 --- a/URI/_punycode.pm +++ b/URI/_punycode.pm @@ -1,6 +1,8 @@ package URI::_punycode; use strict; +use warnings; + our $VERSION = "1.61"; require Exporter; diff --git a/URI/_query.pm b/URI/_query.pm index a6038a3..93288ca 100644 --- a/URI/_query.pm +++ b/URI/_query.pm @@ -1,6 +1,8 @@ package URI::_query; use strict; +use warnings; + use URI (); use URI::Escape qw(uri_unescape); @@ -88,6 +90,6 @@ sub query_keywords } # Some URI::URL compatibility stuff -*equery = \&query; +sub equery { goto &query } 1; diff --git a/URI/_segment.pm b/URI/_segment.pm index c91b696..2c42fc1 100644 --- a/URI/_segment.pm +++ b/URI/_segment.pm @@ -4,6 +4,8 @@ package URI::_segment; # a string too. use strict; +use warnings; + use URI::Escape qw(uri_unescape); use overload '""' => sub { $_[0]->[0] }, diff --git a/URI/_server.pm b/URI/_server.pm index ffa8bdd..c901d8d 100644 --- a/URI/_server.pm +++ b/URI/_server.pm @@ -1,8 +1,11 @@ package URI::_server; -require URI::_generic; -@ISA=qw(URI::_generic); use strict; +use warnings; + +require URI::_generic; +our @ISA=qw(URI::_generic); + use URI::Escape qw(uri_unescape); sub _uric_escape { diff --git a/URI/_userpass.pm b/URI/_userpass.pm index 87d7fb5..db8b53b 100644 --- a/URI/_userpass.pm +++ b/URI/_userpass.pm @@ -1,6 +1,8 @@ package URI::_userpass; use strict; +use warnings; + use URI::Escape qw(uri_unescape); sub user diff --git a/URI/data.pm b/URI/data.pm index a4f4f32..7039c04 100644 --- a/URI/data.pm +++ b/URI/data.pm @@ -1,11 +1,12 @@ package URI::data; # RFC 2397 -require URI; -@ISA=qw(URI); +use strict; +use warnings; -$VERSION = '1.61'; +require URI; +our @ISA=qw(URI); -use strict; +our $VERSION = '1.61'; use MIME::Base64 qw(encode_base64 decode_base64); use URI::Escape qw(uri_unescape); diff --git a/URI/file.pm b/URI/file.pm index 94942ca..f660ea6 100644 --- a/URI/file.pm +++ b/URI/file.pm @@ -1,6 +1,7 @@ package URI::file; use strict; +use warnings; require URI::_generic; our @ISA = qw(URI::_generic); diff --git a/URI/file/Base.pm b/URI/file/Base.pm index 941793b..bba1c9d 100644 --- a/URI/file/Base.pm +++ b/URI/file/Base.pm @@ -1,6 +1,8 @@ package URI::file::Base; use strict; +use warnings; + use URI::Escape qw(); sub new diff --git a/URI/file/FAT.pm b/URI/file/FAT.pm index 328169b..832f423 100644 --- a/URI/file/FAT.pm +++ b/URI/file/FAT.pm @@ -1,7 +1,10 @@ package URI::file::FAT; +use strict; +use warnings; + require URI::file::Win32; -@ISA=qw(URI::file::Win32); +our @ISA=qw(URI::file::Win32); sub fix_path { diff --git a/URI/file/Mac.pm b/URI/file/Mac.pm index 6cfa781..2a21406 100644 --- a/URI/file/Mac.pm +++ b/URI/file/Mac.pm @@ -1,9 +1,11 @@ package URI::file::Mac; +use strict; +use warnings; + require URI::file::Base; -@ISA=qw(URI::file::Base); +our @ISA=qw(URI::file::Base); -use strict; use URI::Escape qw(uri_unescape); diff --git a/URI/file/OS2.pm b/URI/file/OS2.pm index ad0a78e..d603bd0 100644 --- a/URI/file/OS2.pm +++ b/URI/file/OS2.pm @@ -1,7 +1,10 @@ package URI::file::OS2; +use strict; +use warnings; + require URI::file::Win32; -@ISA=qw(URI::file::Win32); +our @ISA=qw(URI::file::Win32); # The Win32 version translates k:/foo to file://k:/foo (?!) # We add an empty host diff --git a/URI/file/QNX.pm b/URI/file/QNX.pm index 93a4983..da14fca 100644 --- a/URI/file/QNX.pm +++ b/URI/file/QNX.pm @@ -1,9 +1,10 @@ package URI::file::QNX; -require URI::file::Unix; -@ISA=qw(URI::file::Unix); - use strict; +use warnings; + +require URI::file::Unix; +our @ISA=qw(URI::file::Unix); sub _file_extract_path { diff --git a/URI/file/Unix.pm b/URI/file/Unix.pm index 5f8aaae..241dc9a 100644 --- a/URI/file/Unix.pm +++ b/URI/file/Unix.pm @@ -1,9 +1,11 @@ package URI::file::Unix; +use strict; +use warnings; + require URI::file::Base; -@ISA=qw(URI::file::Base); +our @ISA=qw(URI::file::Base); -use strict; use URI::Escape qw(uri_unescape); sub _file_extract_path diff --git a/URI/file/Win32.pm b/URI/file/Win32.pm index 0459386..c1aa2ee 100644 --- a/URI/file/Win32.pm +++ b/URI/file/Win32.pm @@ -1,9 +1,11 @@ package URI::file::Win32; +use strict; +use warnings; + require URI::file::Base; -@ISA=qw(URI::file::Base); +our @ISA=qw(URI::file::Base); -use strict; use URI::Escape qw(uri_unescape); sub _file_extract_authority diff --git a/URI/ftp.pm b/URI/ftp.pm index 89aeb07..9bb8aa8 100644 --- a/URI/ftp.pm +++ b/URI/ftp.pm @@ -1,10 +1,11 @@ package URI::ftp; +use strict; +use warnings; + require URI::_server; require URI::_userpass; -@ISA=qw(URI::_server URI::_userpass); - -use strict; +our @ISA=qw(URI::_server URI::_userpass); sub default_port { 21 } diff --git a/URI/gopher.pm b/URI/gopher.pm index ae66904..a289fa5 100644 --- a/URI/gopher.pm +++ b/URI/gopher.pm @@ -1,9 +1,11 @@ package URI::gopher; # , Dec 4, 1996 +use strict; +use warnings; + require URI::_server; -@ISA=qw(URI::_server); +our @ISA=qw(URI::_server); -use strict; use URI::Escape qw(uri_unescape); # A Gopher URL follows the common internet scheme syntax as defined in @@ -58,7 +60,7 @@ sub gopher_type $gtype; } -*gtype = \&gopher_type; # URI::URL compatibility +sub gtype { goto &gopher_type } # URI::URL compatibility sub selector { shift->_gfield(0, @_) } sub search { shift->_gfield(1, @_) } diff --git a/URI/http.pm b/URI/http.pm index cb69822..26866fe 100644 --- a/URI/http.pm +++ b/URI/http.pm @@ -1,9 +1,10 @@ package URI::http; -require URI::_server; -@ISA=qw(URI::_server); - use strict; +use warnings; + +require URI::_server; +our @ISA=qw(URI::_server); sub default_port { 80 } diff --git a/URI/https.pm b/URI/https.pm index 94f9bb1..d319fae 100644 --- a/URI/https.pm +++ b/URI/https.pm @@ -1,6 +1,10 @@ package URI::https; + +use strict; +use warnings; + require URI::http; -@ISA=qw(URI::http); +our @ISA=qw(URI::http); sub default_port { 443 } diff --git a/URI/ldap.pm b/URI/ldap.pm index db38092..0e47adf 100644 --- a/URI/ldap.pm +++ b/URI/ldap.pm @@ -5,6 +5,7 @@ package URI::ldap; use strict; +use warnings; our $VERSION = "1.61"; diff --git a/URI/ldapi.pm b/URI/ldapi.pm index e49878a..b83b183 100644 --- a/URI/ldapi.pm +++ b/URI/ldapi.pm @@ -1,6 +1,7 @@ package URI::ldapi; use strict; +use warnings; require URI::_generic; require URI::_ldap; diff --git a/URI/ldaps.pm b/URI/ldaps.pm index cbf901b..3c710dc 100644 --- a/URI/ldaps.pm +++ b/URI/ldaps.pm @@ -1,6 +1,10 @@ package URI::ldaps; + +use strict; +use warnings; + require URI::ldap; -@ISA=qw(URI::ldap); +our @ISA=qw(URI::ldap); sub default_port { 636 } diff --git a/URI/mailto.pm b/URI/mailto.pm index 88761c4..2ca1951 100644 --- a/URI/mailto.pm +++ b/URI/mailto.pm @@ -1,10 +1,11 @@ package URI::mailto; # RFC 2368 +use strict; +use warnings; + require URI; require URI::_query; -@ISA=qw(URI URI::_query); - -use strict; +our @ISA=qw(URI URI::_query); sub to { diff --git a/URI/mms.pm b/URI/mms.pm index 2f1015b..a016fcb 100644 --- a/URI/mms.pm +++ b/URI/mms.pm @@ -1,7 +1,10 @@ package URI::mms; +use strict; +use warnings; + require URI::http; -@ISA=qw(URI::http); +our @ISA=qw(URI::http); sub default_port { 1755 } diff --git a/URI/news.pm b/URI/news.pm index 1c1a385..0d48684 100644 --- a/URI/news.pm +++ b/URI/news.pm @@ -1,9 +1,11 @@ package URI::news; # draft-gilman-news-url-01 +use strict; +use warnings; + require URI::_server; -@ISA=qw(URI::_server); +our @ISA=qw(URI::_server); -use strict; use URI::Escape qw(uri_unescape); use Carp (); diff --git a/URI/nntp.pm b/URI/nntp.pm index af61e03..cb7cc5a 100644 --- a/URI/nntp.pm +++ b/URI/nntp.pm @@ -1,6 +1,9 @@ package URI::nntp; # draft-gilman-news-url-01 +use strict; +use warnings; + require URI::news; -@ISA=qw(URI::news); +our @ISA=qw(URI::news); 1; diff --git a/URI/pop.pm b/URI/pop.pm index 7f20b5a..700a4ad 100644 --- a/URI/pop.pm +++ b/URI/pop.pm @@ -1,9 +1,11 @@ package URI::pop; # RFC 2384 +use strict; +use warnings; + require URI::_server; -@ISA=qw(URI::_server); +our @ISA=qw(URI::_server); -use strict; use URI::Escape qw(uri_unescape); sub default_port { 110 } diff --git a/URI/rlogin.pm b/URI/rlogin.pm index 18bb762..e381a10 100644 --- a/URI/rlogin.pm +++ b/URI/rlogin.pm @@ -1,6 +1,10 @@ package URI::rlogin; + +use strict; +use warnings; + require URI::_login; -@ISA = qw(URI::_login); +our @ISA = qw(URI::_login); sub default_port { 513 } diff --git a/URI/rsync.pm b/URI/rsync.pm index 160d9d0..3a11125 100644 --- a/URI/rsync.pm +++ b/URI/rsync.pm @@ -2,10 +2,13 @@ package URI::rsync; # http://rsync.samba.org/ # rsync://[USER@]HOST[:PORT]/SRC +use strict; +use warnings; + require URI::_server; require URI::_userpass; -@ISA=qw(URI::_server URI::_userpass); +our @ISA=qw(URI::_server URI::_userpass); sub default_port { 873 } diff --git a/URI/rtsp.pm b/URI/rtsp.pm index 982ca5e..216e07f 100644 --- a/URI/rtsp.pm +++ b/URI/rtsp.pm @@ -1,7 +1,10 @@ package URI::rtsp; +use strict; +use warnings; + require URI::http; -@ISA=qw(URI::http); +our @ISA=qw(URI::http); sub default_port { 554 } diff --git a/URI/rtspu.pm b/URI/rtspu.pm index dbcf12b..754b11b 100644 --- a/URI/rtspu.pm +++ b/URI/rtspu.pm @@ -1,7 +1,10 @@ package URI::rtspu; +use strict; +use warnings; + require URI::rtsp; -@ISA=qw(URI::rtsp); +our @ISA=qw(URI::rtsp); sub default_port { 554 } diff --git a/URI/sip.pm b/URI/sip.pm index e74e49a..af552f8 100644 --- a/URI/sip.pm +++ b/URI/sip.pm @@ -7,11 +7,13 @@ package URI::sip; +use strict; +use warnings; + require URI::_server; require URI::_userpass; our @ISA=qw(URI::_server URI::_userpass); -use strict; use URI::Escape qw(uri_unescape); our $VERSION = "1.61"; diff --git a/URI/sips.pm b/URI/sips.pm index 8d184a3..be7c27f 100644 --- a/URI/sips.pm +++ b/URI/sips.pm @@ -1,6 +1,10 @@ package URI::sips; + +use strict; +use warnings; + require URI::sip; -@ISA=qw(URI::sip); +our @ISA=qw(URI::sip); sub default_port { 5061 } diff --git a/URI/snews.pm b/URI/snews.pm index 4310f81..9116232 100644 --- a/URI/snews.pm +++ b/URI/snews.pm @@ -1,7 +1,10 @@ package URI::snews; # draft-gilman-news-url-01 +use strict; +use warnings; + require URI::news; -@ISA=qw(URI::news); +our @ISA=qw(URI::news); sub default_port { 563 } diff --git a/URI/ssh.pm b/URI/ssh.pm index 1d47e41..2b51013 100644 --- a/URI/ssh.pm +++ b/URI/ssh.pm @@ -1,6 +1,10 @@ package URI::ssh; + +use strict; +use warnings; + require URI::_login; -@ISA=qw(URI::_login); +our @ISA=qw(URI::_login); # ssh://[USER@]HOST[:PORT]/SRC diff --git a/URI/telnet.pm b/URI/telnet.pm index 5f842d3..ce60be4 100644 --- a/URI/telnet.pm +++ b/URI/telnet.pm @@ -1,6 +1,10 @@ package URI::telnet; + +use strict; +use warnings; + require URI::_login; -@ISA = qw(URI::_login); +our @ISA = qw(URI::_login); sub default_port { 23 } diff --git a/URI/tn3270.pm b/URI/tn3270.pm index dd1e648..fe23015 100644 --- a/URI/tn3270.pm +++ b/URI/tn3270.pm @@ -1,6 +1,10 @@ package URI::tn3270; + +use strict; +use warnings; + require URI::_login; -@ISA = qw(URI::_login); +our @ISA = qw(URI::_login); sub default_port { 23 } diff --git a/URI/urn.pm b/URI/urn.pm index 791fd95..264517f 100644 --- a/URI/urn.pm +++ b/URI/urn.pm @@ -1,9 +1,11 @@ package URI::urn; # RFC 2141 +use strict; +use warnings; + require URI; -@ISA=qw(URI); +our @ISA=qw(URI); -use strict; use Carp qw(carp); my %implementor; diff --git a/URI/urn/isbn.pm b/URI/urn/isbn.pm index 0da931b..deffaae 100644 --- a/URI/urn/isbn.pm +++ b/URI/urn/isbn.pm @@ -1,9 +1,11 @@ package URI::urn::isbn; # RFC 3187 +use strict; +use warnings; + require URI::urn; -@ISA=qw(URI::urn); +our @ISA=qw(URI::urn); -use strict; use Carp qw(carp); BEGIN { diff --git a/URI/urn/oid.pm b/URI/urn/oid.pm index 301b2bc..6940275 100644 --- a/URI/urn/oid.pm +++ b/URI/urn/oid.pm @@ -1,9 +1,10 @@ package URI::urn::oid; # RFC 2061 -require URI::urn; -@ISA=qw(URI::urn); - use strict; +use warnings; + +require URI::urn; +our @ISA=qw(URI::urn); sub oid { my $self = shift; diff --git a/t/abs.t b/t/abs.t index e2dad70..fa761e0 100644 --- a/t/abs.t +++ b/t/abs.t @@ -1,13 +1,17 @@ #!perl -w +use strict; +use warnings; + print "1..45\n"; # This test the resolution of abs path for all examples given # in the "Uniform Resource Identifiers (URI): Generic Syntax" document. use URI; -$base = "http://a/b/c/d;p?q"; -$testno = 1; +my $base = "http://a/b/c/d;p?q"; +my $testno = 1; +my @rel_fail; while () { #next if 1 .. /^C\.\s+/; diff --git a/t/clone.t b/t/clone.t index 2d49a14..72b0cea 100644 --- a/t/clone.t +++ b/t/clone.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..2\n"; -use strict; use URI::URL; my $b = URI::URL->new("http://www/"); diff --git a/t/cwd.t b/t/cwd.t index 90e1859..784ef16 100644 --- a/t/cwd.t +++ b/t/cwd.t @@ -1,5 +1,8 @@ #!perl -Tw +use strict; +use warnings; + use Test; plan tests => 1; diff --git a/t/data.t b/t/data.t index 0e23e76..cfec71a 100644 --- a/t/data.t +++ b/t/data.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + eval { require MIME::Base64; }; @@ -13,7 +16,7 @@ print "1..22\n"; use URI; -$u = URI->new("data:,A%20brief%20note"); +my $u = URI->new("data:,A%20brief%20note"); print "not " unless $u->scheme eq "data" && $u->opaque eq ",A%20brief%20note"; print "ok 1\n"; @@ -21,7 +24,7 @@ print "not " unless $u->media_type eq "text/plain;charset=US-ASCII" && $u->data eq "A brief note"; print "ok 2\n"; -$old = $u->data("Får-i-kål er tingen!"); +my $old = $u->data("Får-i-kål er tingen!"); print "not " unless $old eq "A brief note" && $u eq "data:,F%E5r-i-k%E5l%20er%20tingen!"; print "ok 3\n"; diff --git a/t/file.t b/t/file.t index e89c1a1..377397a 100644 --- a/t/file.t +++ b/t/file.t @@ -1,8 +1,11 @@ #!perl -Tw +use strict; +use warnings; + use URI::file; -@tests = ( +my @tests = ( [ "file", "unix", "win32", "mac" ], #---------------- ------------ --------------- -------------- [ "file://localhost/foo/bar", @@ -21,22 +24,22 @@ use URI::file; [ "../%2E%2E", "!../..", "!..\\..", "::.."], ); -@os = @{shift @tests}; +my @os = @{shift @tests}; shift @os; # file my $num = @tests; print "1..$num\n"; -$testno = 1; +my $testno = 1; -for $t (@tests) { +for my $t (@tests) { my @t = @$t; my $file = shift @t; my $err; my $u = URI->new($file, "file"); my $i = 0; - for $os (@os) { + for my $os (@os) { my $f = $u->file($os); my $expect = $t[$i]; $f = "" unless defined $f; @@ -48,7 +51,7 @@ for $t (@tests) { $err++; } if (defined($t[$i]) && !$loose) { - $u2 = URI::file->new($t[$i], $os); + my $u2 = URI::file->new($t[$i], $os); unless ($u2->as_string eq $file) { print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n"; $err++; diff --git a/t/ftp.t b/t/ftp.t index 066f1d3..4f9bc60 100644 --- a/t/ftp.t +++ b/t/ftp.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..13\n"; -use strict; use URI; my $uri; diff --git a/t/generic.t b/t/generic.t index 0b6954c..b308674 100644 --- a/t/generic.t +++ b/t/generic.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..48\n"; use URI; -$foo = URI->new("Foo:opaque#frag"); +my $foo = URI->new("Foo:opaque#frag"); print "not " unless ref($foo) eq "URI::_foreign"; print "ok 1\n"; @@ -29,7 +32,7 @@ print "not " unless $foo->canonical eq "foo:opaque#frag"; print "ok 7\n"; # Try modificators -$old = $foo->scheme("bar"); +my $old = $foo->scheme("bar"); print "not " unless $old eq "foo" && $foo eq "bar:opaque#frag"; print "ok 8\n"; diff --git a/t/gopher.t b/t/gopher.t index 2b23761..de2db60 100644 --- a/t/gopher.t +++ b/t/gopher.t @@ -1,5 +1,7 @@ #!perl -w + use strict; +use warnings; print "1..48\n"; diff --git a/t/heuristic.t b/t/heuristic.t index 42c7663..dc4d510 100644 --- a/t/heuristic.t +++ b/t/heuristic.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + BEGIN { # mock up a gethostbyname that always works :-) *CORE::GLOBAL::gethostbyname = sub { diff --git a/t/http.t b/t/http.t index f85113f..5e2459d 100644 --- a/t/http.t +++ b/t/http.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..16\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "http://www.perl.com/path?q=f%F4o"; @@ -14,7 +17,7 @@ print "not " unless $u->port == 80; print "ok 2\n"; # play with port -$old = $u->port(8080); +my $old = $u->port(8080); print "not " unless $old == 80 && $u eq "http://www.perl.com:8080/path?q=f%F4o"; print "ok 3\n"; @@ -30,7 +33,7 @@ $u->port(undef); print "not " unless $u eq "http://www.perl.com/path?q=f%F4o"; print "ok 6\n"; -@q = $u->query_form; +my @q = $u->query_form; print "not " unless @q == 2 && "@q" eq "q fôo"; print "ok 7\n"; diff --git a/t/idna.t b/t/idna.t index a385e9d..859d4b9 100644 --- a/t/idna.t +++ b/t/idna.t @@ -1,6 +1,8 @@ #!perl -w use strict; +use warnings; + use utf8; use Test::More tests => 7; use URI::_idna; diff --git a/t/iri.t b/t/iri.t index a64f5d1..67f8e98 100644 --- a/t/iri.t +++ b/t/iri.t @@ -1,7 +1,9 @@ #!perl -w -use utf8; use strict; +use warnings; + +use utf8; use Test::More; use Config; diff --git a/t/ldap.t b/t/ldap.t index 8a7e00d..4ba4735 100644 --- a/t/ldap.t +++ b/t/ldap.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..24\n"; -use strict; use URI; my $uri; diff --git a/t/mailto.t b/t/mailto.t index f4fae5e..b8838f6 100644 --- a/t/mailto.t +++ b/t/mailto.t @@ -1,16 +1,19 @@ #!perl -w +use strict; +use warnings; + print "1..7\n"; use URI; -$u = URI->new('mailto:gisle@aas.no'); +my $u = URI->new('mailto:gisle@aas.no'); print "not " unless $u->to eq 'gisle@aas.no' && $u eq 'mailto:gisle@aas.no'; print "ok 1\n"; -$old = $u->to('larry@wall.org'); +my $old = $u->to('larry@wall.org'); print "not " unless $old eq 'gisle@aas.no' && $u->to eq 'larry@wall.org' && $u eq 'mailto:larry@wall.org'; @@ -21,7 +24,7 @@ print "not " unless $u->to eq "?/#" && $u eq 'mailto:%3F/%23'; print "ok 3\n"; -@h = $u->headers; +my @h = $u->headers; print "not " unless @h == 2 && "@h" eq "to ?/#"; print "ok 4\n"; diff --git a/t/mix.t b/t/mix.t index 46d9e4f..e7da25c 100644 --- a/t/mix.t +++ b/t/mix.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + print "1..6\n"; # Test mixing of URI and URI::WithBase objects @@ -7,12 +10,17 @@ use URI; use URI::WithBase; use URI::URL; -$str = "http://www.sn.no/"; -$rel = "path/img.gif"; +my $str = "http://www.sn.no/"; +my $rel = "path/img.gif"; + +my $u = URI->new($str); +my $uw = URI::WithBase->new($str, "http:"); +my $uu = URI::URL->new($str); -$u = URI->new($str); -$uw = URI::WithBase->new($str, "http:"); -$uu = URI::URL->new($str); +my $a = URI->new($rel, $u); +my $b = URI->new($rel, $uw); +my $c = URI->new($rel, $uu); +my $d = URI->new($rel, $str); sub Dump { @@ -20,11 +28,6 @@ sub Dump print Data::Dumper->Dump([$a, $b, $c, $d], [qw(a b c d)]); } -$a = URI->new($rel, $u); -$b = URI->new($rel, $uw); -$c = URI->new($rel, $uu); -$d = URI->new($rel, $str); - #Dump(); print "not " unless $a->isa("URI") && ref($b) eq ref($uw) && diff --git a/t/mms.t b/t/mms.t index 03fdcea..4723af5 100644 --- a/t/mms.t +++ b/t/mms.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..8\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "mms://66.250.188.13/KFOG_FM"; @@ -14,7 +17,7 @@ print "not " unless $u->port == 1755; print "ok 2\n"; # play with port -$old = $u->port(8755); +my $old = $u->port(8755); print "not " unless $old == 1755 && $u eq "mms://66.250.188.13:8755/KFOG_FM"; print "ok 3\n"; diff --git a/t/news.t b/t/news.t index ea5b005..267445a 100644 --- a/t/news.t +++ b/t/news.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..7\n"; use URI; -$u = URI->new("news:comp.lang.perl.misc"); +my $u = URI->new("news:comp.lang.perl.misc"); print "not " unless $u->group eq "comp.lang.perl.misc" && !defined($u->message) && @@ -23,7 +26,7 @@ $u->group("no.perl", 1 => 10); print "not " unless $u eq "news://news.online.no/no.perl/1-10"; print "ok 3\n"; -@g = $u->group; +my @g = $u->group; #print "G: @g\n"; print "not " unless @g == 3 && "@g" eq "no.perl 1 10"; print "ok 4\n"; diff --git a/t/num_eq.t b/t/num_eq.t index b5e1267..2906f6c 100644 --- a/t/num_eq.t +++ b/t/num_eq.t @@ -4,6 +4,7 @@ # equality use strict; +use warnings; use Test::More 'no_plan'; use URI; diff --git a/t/old-absconf.t b/t/old-absconf.t index c74d78b..0a4938c 100644 --- a/t/old-absconf.t +++ b/t/old-absconf.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + print "1..6\n"; use URI::URL qw(url); @@ -9,7 +12,7 @@ use URI::URL qw(url); $URI::URL::ABS_REMOTE_LEADING_DOTS = 1; $URI::URL::ABS_ALLOW_RELATIVE_SCHEME = 1; -$u1 = url("../../../../abc", "http://web/a/b"); +my $u1 = url("../../../../abc", "http://web/a/b"); print "not " unless $u1->abs->as_string eq "http://web/abc"; print "ok 1\n"; diff --git a/t/old-base.t b/t/old-base.t index a0c87a7..151fae9 100644 --- a/t/old-base.t +++ b/t/old-base.t @@ -1,5 +1,8 @@ #!/local/bin/perl -w +use strict; +use warnings; + use URI::URL qw(url); use URI::Escape qw(uri_escape uri_unescape); use File::Temp 'tempdir'; @@ -30,7 +33,7 @@ package main; # Must ensure that there is no relative paths in @INC because we will # chdir in the newlocal tests. unless ($^O eq "MacOS") { -chomp($pwd = ($^O =~ /mswin32/i ? `cd` : $^O eq 'VMS' ? `show default` : `pwd`)); +chomp(my $pwd = ($^O =~ /mswin32/i ? `cd` : $^O eq 'VMS' ? `show default` : `pwd`)); if ($^O eq 'VMS') { $pwd =~ s#^\s+##; $pwd = VMS::Filespec::unixpath($pwd); @@ -83,7 +86,7 @@ print "ok 6\n"; # Let's test making our own things URI::URL::strict(0); # This should work after URI::URL::strict(0) -$url = new URI::URL "x-myscheme:something"; +my $url = new URI::URL "x-myscheme:something"; # Since no implementor is registered for 'x-myscheme' then it will # be handled by the URI::URL::_generic class $url->_expect('as_string' => 'x-myscheme:something'); @@ -147,7 +150,7 @@ sub scheme_parse_test { print "scheme_parse_test:\n"; - $tests = { + my $tests = { 'hTTp://web1.net/a/b/c/welcome#intro' => { 'scheme'=>'http', 'host'=>'web1.net', 'port'=>80, 'path'=>'/a/b/c/welcome', 'frag'=>'intro','query'=>undef, @@ -254,11 +257,11 @@ sub scheme_parse_test { # 'password'=>'pswd' }, }; - foreach $url_str (sort keys %$tests ){ + foreach my $url_str (sort keys %$tests ){ print "Testing '$url_str'\n"; my $url = new URI::URL $url_str; my $tests = $tests->{$url_str}; - while( ($method, $exp) = each %$tests ){ + while( my ($method, $exp) = each %$tests ){ $exp = 'UNDEF' unless defined $exp; $url->_expect($method, $exp); } @@ -629,7 +632,7 @@ sub escape_test { $url->frag($reserved); $url->_expect('as_string', 'http://h/;%3B%2F%3F%3A%40&=%23%25?%3B%2F%3F%3A%40&=%23%25#;/?:@&=#%'); - $str = $url->as_string; + my $str = $url->as_string; $url = new URI::URL $str; die "URL changed" if $str ne $url->as_string; @@ -797,7 +800,7 @@ sub absolute_test { my $base = 'http://a/b/c/d;p?q#f'; - $absolute_tests = < @@ -872,7 +875,8 @@ EOM # convert text to list like # @absolute_tests = ( ['g:h' => 'g:h'], ...) - for $line (split("\n", $absolute_tests)) { + my @absolute_tests; + for my $line (split("\n", $absolute_tests)) { next unless $line =~ /^\s{6}/; if ($line =~ /^\s+(\S+)\s*=\s*]*)>/) { my($rel, $abs) = ($1, $2); @@ -896,7 +900,7 @@ EOM print " Relative + Base => Expected Absolute URL\n"; print "================================================\n"; - for $test (@absolute_tests) { + for my $test (@absolute_tests) { my($rel, $abs) = @$test; my $abs_url = new URI::URL $abs; my $abs_str = $abs_url->as_string; diff --git a/t/old-file.t b/t/old-file.t index 3ee7032..1162614 100644 --- a/t/old-file.t +++ b/t/old-file.t @@ -1,9 +1,12 @@ #!perl -w +use strict; +use warnings; + use URI::file; $URI::file::DEFAULT_AUTHORITY = undef; -@tests = ( +my @tests = ( [ "file", "unix", "win32", "mac" ], #---------------- ------------ --------------- -------------- [ "file://localhost/foo/bar", @@ -22,7 +25,7 @@ $URI::file::DEFAULT_AUTHORITY = undef; [ "../%2E%2E", "!../..", "!..\\..", "::.."], ); if ($^O eq "MacOS") { -@extratests = ( +my @extratests = ( [ "../..", "../..", "..\\..", ":::"], [ "../../", "../../", "..\\..\\", "!:::"], [ "file:./foo.bar", "!./foo.bar", "!.\\foo.bar", "!:foo.bar"], @@ -39,22 +42,22 @@ if ($^O eq "MacOS") { push(@tests,@extratests); } -@os = @{shift @tests}; +my @os = @{shift @tests}; shift @os; # file my $num = @tests; print "1..$num\n"; -$testno = 1; +my $testno = 1; -for $t (@tests) { +for my $t (@tests) { my @t = @$t; my $file = shift @t; my $err; my $u = URI->new($file, "file"); my $i = 0; - for $os (@os) { + for my $os (@os) { my $f = $u->file($os); my $expect = $t[$i]; $f = "" unless defined $f; @@ -66,7 +69,7 @@ for $t (@tests) { $err++; } if (defined($t[$i]) && !$loose) { - $u2 = URI::file->new($t[$i], $os); + my $u2 = URI::file->new($t[$i], $os); unless ($u2->as_string eq $file) { print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n"; $err++; diff --git a/t/old-relbase.t b/t/old-relbase.t index 05db62f..a4e8025 100644 --- a/t/old-relbase.t +++ b/t/old-relbase.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + print "1..5\n"; use URI::URL; @@ -7,13 +10,13 @@ use URI::URL; # We used to have problems with URLs that used a base that was # not absolute itself. -$u1 = url("/foo/bar", "http://www.acme.com/"); -$u2 = url("../foo/", $u1); -$u3 = url("zoo/foo", $u2); +my $u1 = url("/foo/bar", "http://www.acme.com/"); +my $u2 = url("../foo/", $u1); +my $u3 = url("zoo/foo", $u2); -$a1 = $u1->abs->as_string; -$a2 = $u2->abs->as_string; -$a3 = $u3->abs->as_string; +my $a1 = $u1->abs->as_string; +my $a2 = $u2->abs->as_string; +my $a3 = $u3->abs->as_string; print "$a1\n$a2\n$a3\n"; @@ -25,8 +28,8 @@ print "not " unless $a3 eq "http://www.acme.com/foo/zoo/foo"; print "ok 3\n"; # We used to have problems with URI::URL as the base class :-( -$u4 = url("foo", "URI::URL"); -$a4 = $u4->abs; +my $u4 = url("foo", "URI::URL"); +my $a4 = $u4->abs; print "$a4\n"; print "not " unless $u4 eq "foo" && $a4 eq "uri:/foo"; print "ok 4\n"; diff --git a/t/pop.t b/t/pop.t index a8d446f..8932e44 100644 --- a/t/pop.t +++ b/t/pop.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..8\n"; use URI; -$u = URI->new('pop://aas@pop.sn.no'); +my $u = URI->new('pop://aas@pop.sn.no'); print "not " unless $u->user eq "aas" && !defined($u->auth) && diff --git a/t/punycode.t b/t/punycode.t index dbb2881..91c1d49 100644 --- a/t/punycode.t +++ b/t/punycode.t @@ -1,6 +1,8 @@ #!perl -w use strict; +use warnings; + use utf8; use Test::More tests => 15; use URI::_punycode qw(encode_punycode decode_punycode); diff --git a/t/query-param.t b/t/query-param.t index 8d02263..777d83a 100644 --- a/t/query-param.t +++ b/t/query-param.t @@ -1,6 +1,7 @@ #!perl -w use strict; +use warnings; use Test::More tests => 19; diff --git a/t/query.t b/t/query.t index 109ecee..98ceacd 100644 --- a/t/query.t +++ b/t/query.t @@ -1,6 +1,8 @@ #!perl -w use strict; +use warnings; + use Test::More tests => 23; use URI (); diff --git a/t/rel.t b/t/rel.t index 29f1642..12c5b60 100644 --- a/t/rel.t +++ b/t/rel.t @@ -1,10 +1,12 @@ #!/usr/bin/perl -w +use strict; +use warnings; + use Test; plan tests => 6; -use strict; use URI; my $uri; diff --git a/t/rfc2732.t b/t/rfc2732.t index 0787e30..b11dea9 100644 --- a/t/rfc2732.t +++ b/t/rfc2732.t @@ -3,6 +3,8 @@ # Test URIs containing IPv6 addresses use strict; +use warnings; + use Test::More tests => 19; use URI; diff --git a/t/roy-test.t b/t/roy-test.t index c3ca4aa..23c7e9a 100644 --- a/t/roy-test.t +++ b/t/roy-test.t @@ -1,6 +1,8 @@ #!perl -w use strict; +use warnings; + use Test qw(plan ok); plan tests => 102; diff --git a/t/rsync.t b/t/rsync.t index b53e0cf..1585aab 100644 --- a/t/rsync.t +++ b/t/rsync.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..4\n"; -use strict; use URI; my $u = URI->new('rsync://gisle@perl.com/foo/bar'); diff --git a/t/rtsp.t b/t/rtsp.t index c1eb342..46c8a62 100644 --- a/t/rtsp.t +++ b/t/rtsp.t @@ -1,10 +1,13 @@ #!perl -w +use strict; +use warnings; + print "1..9\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "rtsp://media.perl.com/f%F4o.smi/"; @@ -14,7 +17,7 @@ print "not " unless $u->port == 554; print "ok 2\n"; # play with port -$old = $u->port(8554); +my $old = $u->port(8554); print "not " unless $old == 554 && $u eq "rtsp://media.perl.com:8554/f%F4o.smi/"; print "ok 3\n"; diff --git a/t/sip.t b/t/sip.t index 302f4a7..993295f 100644 --- a/t/sip.t +++ b/t/sip.t @@ -1,9 +1,11 @@ #!perl -w +use strict; +use warnings; + print "1..11\n"; use URI; -use strict; my $u = URI->new('sip:phone@domain.ext'); print "not " unless $u->user eq 'phone' && diff --git a/t/split.t b/t/split.t index dcb43a4..b8e2631 100644 --- a/t/split.t +++ b/t/split.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..17\n"; -use strict; use URI::Split qw(uri_split uri_join); sub j { join("-", map { defined($_) ? $_ : "" } @_) } diff --git a/t/storable-test.pl b/t/storable-test.pl index 45e0572..c558fa4 100644 --- a/t/storable-test.pl +++ b/t/storable-test.pl @@ -1,6 +1,7 @@ #!perl -w use strict; +use warnings; use Storable; if (@ARGV && $ARGV[0] eq "store") { diff --git a/t/storable.t b/t/storable.t index afe6837..6343b3f 100644 --- a/t/storable.t +++ b/t/storable.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + eval { require Storable; print "1..3\n"; diff --git a/t/urn-isbn.t b/t/urn-isbn.t index 22f827f..998aaa2 100644 --- a/t/urn-isbn.t +++ b/t/urn-isbn.t @@ -1,5 +1,8 @@ #!perl -w +use strict; +use warnings; + eval { require Business::ISBN; }; diff --git a/t/urn-oid.t b/t/urn-oid.t index 88e60ac..105f3a1 100644 --- a/t/urn-oid.t +++ b/t/urn-oid.t @@ -1,8 +1,10 @@ #!perl -w +use strict; +use warnings; + print "1..4\n"; -use strict; use URI; my $u = URI->new("urn:oid"); diff --git a/uri-test b/uri-test index 1e4f4d8..ca30ef8 100755 --- a/uri-test +++ b/uri-test @@ -1,5 +1,8 @@ #!/usr/bin/perl -w +use strict; +use warnings; + sub usage { my $prog = $0; $prog =~ s,.*/,,; die "Usage: $prog [ []...]\n"; -- cgit v1.2.1