develooper Front page | perl.perl5.porters | Postings from July 2001

[PATCH] deprecate package with no arguments

Thread Next
Robin Houston
July 10, 2001 05:35
[PATCH] deprecate package with no arguments
Message ID:
Well, _so_ far nobody has objected to my proposal. Here's a patch.
I confess that I don't entirely understand the new test mechanism
for libraries, so it's possible that there's something wrong with
the way I've added the test. Let me know...

The patch is against perl@11238.


--- ./op.c.orig	Tue Jul 10 09:52:42 2001
+++ ./op.c	Tue Jul 10 10:07:54 2001
@@ -3197,6 +3197,7 @@
     else {
+	deprecate("\"package\" with no arguments");
 	PL_curstash = Nullhv;
--- ./pod/perldiag.pod.orig	Tue Jul 10 10:03:58 2001
+++ ./pod/perldiag.pod	Tue Jul 10 10:15:11 2001
@@ -3868,6 +3868,13 @@
 you should remove AutoLoader from @ISA and change C<use AutoLoader;> to
 C<use AutoLoader 'AUTOLOAD';>.
+=item Use of "package" with no arguments is deprecated
+(D deprecated) You used the C<package> 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<use strict;>
 =item Use of %s in printf format not supported
 (F) You attempted to use a feature of printf that is accessible from
--- ./pod/perlfunc.pod.orig	Tue Jul 10 09:52:23 2001
+++ ./pod/perlfunc.pod	Tue Jul 10 10:01:26 2001
@@ -3404,8 +3404,10 @@
 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<use strict>, 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<perlmod/"Packages"> for more information about packages, modules,
 and classes.  See L<perlsub> for other scoping issues.
--- ./t/lib/warnings/op.orig	Tue Jul 10 10:21:52 2001
+++ ./t/lib/warnings/op	Tue Jul 10 10:31:55 2001
@@ -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 @@
 Non-octal literal mode (777) specified at - line 3.
 	(Did you mean 0777 instead?)
+# op.c
+use warnings 'deprecated' ;
+no warnings 'deprecated' ;
+Use of "package" with no arguments is deprecated at - line 3.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About