remove some indirect method calls, add a caveat
authorRicardo SIGNES <rjbs@cpan.org>
Tue, 20 Jan 2009 23:21:34 +0000 (18:21 -0500)
committerVincent Pit <vince@profvince.com>
Wed, 21 Jan 2009 15:48:31 +0000 (16:48 +0100)
pod/perlcall.pod
pod/perlfunc.pod
pod/perlglossary.pod
pod/perlothrtut.pod

index 08173d2..06f3aa3 100644 (file)
@@ -1218,9 +1218,9 @@ virtual. The static method, C<PrintID>, prints out simply the class
 name and a version number. The virtual method, C<Display>, prints out a
 single element of the array.  Here is an all Perl example of using it.
 
-    $a = new Mine ('red', 'green', 'blue');
+    $a = Mine->new('red', 'green', 'blue');
     $a->Display(1);
-    PrintID Mine;
+    Mine->PrintID;
 
 will print
 
@@ -1277,7 +1277,7 @@ the C<PrintID> and C<Display> methods from C.
 
 So the methods C<PrintID> and C<Display> can be invoked like this
 
-    $a = new Mine ('red', 'green', 'blue');
+    $a = Mine->new('red', 'green', 'blue');
     call_Method($a, 'Display', 1);
     call_PrintID('Mine', 'PrintID');
 
index 4814ac7..f8d2282 100644 (file)
@@ -4675,7 +4675,7 @@ into package C<main>.)  Here is a typical code layout:
     }
 
     # In the main program
-    push @INC, new Foo(...);
+    push @INC, Foo->new(...);
 
 Note that these hooks are also permitted to set the %INC entry
 corresponding to the files they have loaded. See L<perlvar/%INC>.
index d22e2ac..f0240b0 100644 (file)
@@ -1457,6 +1457,9 @@ invocant between the method and its arguments:
   give $gollum "Fisssssh!";
   give $gollum "Precious!";
 
+In modern Perl, calling methods this way is often considered bad practice and
+to be avoided.
+
 =item indirect object slot
 
 The syntactic position falling between a method call and its arguments
index 3253097..e0d69c5 100644 (file)
@@ -607,10 +607,10 @@ this:
     sleep 10; 
     $DataQueue->enqueue(undef);
 
-You create the queue with new Thread::Queue.  Then you can add lists of
-scalars onto the end with enqueue(), and pop scalars off the front of
-it with dequeue().  A queue has no fixed size, and can grow as needed
-to hold everything pushed on to it.
+You create the queue with C<< Thread::Queue->new >>.  Then you can add
+lists of scalars onto the end with enqueue(), and pop scalars off the
+front of it with dequeue().  A queue has no fixed size, and can grow as
+needed to hold everything pushed on to it.
 
 If a queue is empty, dequeue() blocks until another thread enqueues
 something.  This makes queues ideal for event loops and other
@@ -740,10 +740,10 @@ it.  A more elaborate example looks like this:
 
     use Thread qw(yield); 
 
-    new Thread \&thread_sub, 1; 
-    new Thread \&thread_sub, 2; 
-    new Thread \&thread_sub, 3; 
-    new Thread \&thread_sub, 4;
+    Thread->new(\&thread_sub, 1);
+    Thread->new(\&thread_sub, 2);
+    Thread->new(\&thread_sub, 3);
+    Thread->new(\&thread_sub, 4);
 
     sub sync_sub :locked { 
         my $CallingThread = shift @_; 
@@ -790,7 +790,7 @@ method attribute indicates whether the subroutine is really a method.
     }
 
     foreach my $thrnum (1..10) { 
-        new Thread \&tester, $thrnum; 
+        Thread->new(\&tester, $thrnum);
     }
 
     package Foo;