From: Robin Houston Date: Tue, 10 Jul 2001 13:33:40 +0000 (+0100) Subject: deprecate package with no arguments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f2c0fa378e55ca42d398c29e02f5dc2fd742d1dc;p=p5sagit%2Fp5-mst-13.2.git deprecate package with no arguments Message-ID: <20010710133340.A13452@robin.kitsite.com> p4raw-id: //depot/perl@11256 --- diff --git a/op.c b/op.c index 1790fd6..baa62fb 100644 --- a/op.c +++ b/op.c @@ -3197,6 +3197,7 @@ Perl_package(pTHX_ OP *o) op_free(o); } else { + deprecate("\"package\" with no arguments"); sv_setpv(PL_curstname,""); PL_curstash = Nullhv; } diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c754333..65cde01 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3868,6 +3868,13 @@ In code that currently says C you should remove AutoLoader from @ISA and change C to C. +=item Use of "package" with no arguments is deprecated + +(D deprecated) You used the C keyword without specifying a package +name. So no namespace is current at all. Using this can cause many +otherwise reasonable constructs to fail in baffling ways. C +instead. + =item Use of %s in printf format not supported (F) You attempted to use a feature of printf that is accessible from diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 1039cd0..6deeadb 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3404,8 +3404,10 @@ C<$::sail> is equivalent to C<$main::sail> (as well as to C<$main'sail>, still seen in older code). If NAMESPACE is omitted, then there is no current package, and all -identifiers must be fully qualified or lexicals. This is stricter -than C, since it also extends to function names. +identifiers must be fully qualified or lexicals. However, you are +strongly advised not to make use of this feature. Its use can cause +unexpected behaviour, even crashing some versions of Perl. It is +deprecated, and will be removed from a future release. See L for more information about packages, modules, and classes. See L for other scoping issues. diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 0079146..d3a2d54 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -108,6 +108,9 @@ mkdir "foo", 777; umask 222; + Use of "package" with no arguments is deprecated + package; + Mandatory Warnings ------------------ Prototype mismatch: [cv_ckproto] @@ -958,3 +961,11 @@ mkdir "", 777; EXPECT Non-octal literal mode (777) specified at - line 3. (Did you mean 0777 instead?) +######## +# op.c +use warnings 'deprecated' ; +package; +no warnings 'deprecated' ; +package; +EXPECT +Use of "package" with no arguments is deprecated at - line 3.