Change 27498 by [EMAIL PROTECTED] on 2006/03/14 17:02:38
Make usage of :unique emit a deprecation warning.
Remove its outdated documentation.
Affected files ...
... //depot/perl/cv.h#65 edit
... //depot/perl/pod/perldiag.pod#441 edit
... //depot/perl/pod/perlfunc.pod#516 edit
... //depot/perl/t/lib/warnings/toke#17 edit
... //depot/perl/toke.c#664 edit
Differences ...
==== //depot/perl/cv.h#65 (text) ====
Index: perl/cv.h
--- perl/cv.h#64~27380~ 2006-03-05 10:13:42.000000000 -0800
+++ perl/cv.h 2006-03-14 09:02:38.000000000 -0800
@@ -136,9 +136,7 @@
#define CVf_CLONED 0x0040 /* a clone of one of those */
#define CVf_ANON 0x0080 /* CvGV() can't be trusted */
#define CVf_UNIQUE 0x0100 /* sub is only called once (eg PL_main_cv,
- * require, eval). Not to be confused
- * with the GVf_UNIQUE flag associated
- * with the :unique attribute */
+ * require, eval). */
#define CVf_NODEBUG 0x0200 /* no DB::sub indirection for this CV
(esp. useful for special XSUBs) */
#define CVf_CONST 0x0400 /* inlinable sub */
==== //depot/perl/pod/perldiag.pod#441 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod#440~27237~ 2006-02-20 00:54:22.000000000 -0800
+++ perl/pod/perldiag.pod 2006-03-14 09:02:38.000000000 -0800
@@ -3938,8 +3938,7 @@
=item The 'unique' attribute may only be applied to 'our' variables
-(F) Currently this attribute is not supported on C<my> or C<sub>
-declarations. See L<perlfunc/our>.
+(F) This attribute was never supported on C<my> or C<sub> declarations.
=item This Perl can't reset CRTL environ elements (%s)
==== //depot/perl/pod/perlfunc.pod#516 (text) ====
Index: perl/pod/perlfunc.pod
--- perl/pod/perlfunc.pod#515~27483~ 2006-03-12 07:12:29.000000000 -0800
+++ perl/pod/perlfunc.pod 2006-03-14 09:02:38.000000000 -0800
@@ -3490,30 +3490,6 @@
L<perlsub/"Private Variables via my()"> for details, and L<fields>,
L<attributes>, and L<Attribute::Handlers>.
-The only currently recognized C<our()> attribute is C<unique> which
-indicates that a single copy of the global is to be used by all
-interpreters should the program happen to be running in a
-multi-interpreter environment. (The default behaviour would be for
-each interpreter to have its own copy of the global.) Examples:
-
- our @EXPORT : unique = qw(foo);
- our %EXPORT_TAGS : unique = (bar => [qw(aa bb cc)]);
- our $VERSION : unique = "1.00";
-
-Note that this attribute also has the effect of making the global
-readonly when the first new interpreter is cloned (for example,
-when the first new thread is created).
-
-Multi-interpreter environments can come to being either through the
-fork() emulation on Windows platforms, or by embedding perl in a
-multi-threaded application. The C<unique> attribute does nothing in
-all other environments.
-
-Warning: the current implementation of this attribute operates on the
-typeglob associated with the variable; this means that C<our $x : unique>
-also has the effect of C<our @x : unique; our %x : unique>. This may be
-subject to change.
-
=item pack TEMPLATE,LIST
X<pack>
==== //depot/perl/t/lib/warnings/toke#17 (text) ====
Index: perl/t/lib/warnings/toke
--- perl/t/lib/warnings/toke#16~22553~ 2004-03-22 11:25:59.000000000 -0800
+++ perl/t/lib/warnings/toke 2006-03-14 09:02:38.000000000 -0800
@@ -844,3 +844,10 @@
!=~ should be !~ at - line 8.
!=~ should be !~ at - line 9.
!=~ should be !~ at - line 10.
+########
+# toke.c
+our $foo :unique;
+use warnings 'deprecated';
+our $bar :unique;
+EXPECT
+Use of :unique is deprecated at - line 4.
==== //depot/perl/toke.c#664 (text) ====
Index: perl/toke.c
--- perl/toke.c#663~27480~ 2006-03-11 15:40:34.000000000 -0800
+++ perl/toke.c 2006-03-14 09:02:38.000000000 -0800
@@ -4022,12 +4022,14 @@
}
else {
if (len == 6 && strnEQ(s, "unique", len)) {
- if (PL_in_my == KEY_our)
+ if (PL_in_my == KEY_our) {
#ifdef USE_ITHREADS
GvUNIQUE_on(cGVOPx_gv(yylval.opval));
#else
- /*EMPTY*/; /* skip to avoid loading
attributes.pm */
+ /* skip to avoid loading attributes.pm */
+ deprecate(":unique");
#endif
+ }
else
Perl_croak(aTHX_ "The 'unique' attribute may only
be applied to 'our' variables");
}
End of Patch.