summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorRicardo SIGNES <rjbs@cpan.org>2009-01-20 18:21:34 -0500
committerVincent Pit <vince@profvince.com>2009-01-21 16:48:31 +0100
commit797f796a9610b63f252016d76732152c8ff9fb39 (patch)
tree63c43409db45ec372a6118881a0299ad9022b10c /pod
parent8253c7d6f3a6d423dafff6207f708e56413f162d (diff)
downloadperl-797f796a9610b63f252016d76732152c8ff9fb39.tar.gz
remove some indirect method calls, add a caveat
Diffstat (limited to 'pod')
-rw-r--r--pod/perlcall.pod6
-rw-r--r--pod/perlfunc.pod2
-rw-r--r--pod/perlglossary.pod3
-rw-r--r--pod/perlothrtut.pod18
4 files changed, 16 insertions, 13 deletions
diff --git a/pod/perlcall.pod b/pod/perlcall.pod
index 08173d2e69..06f3aa33c7 100644
--- a/pod/perlcall.pod
+++ b/pod/perlcall.pod
@@ -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');
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 4814ac774b..f8d2282d51 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -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>.
diff --git a/pod/perlglossary.pod b/pod/perlglossary.pod
index d22e2ac6ec..f0240b0c9e 100644
--- a/pod/perlglossary.pod
+++ b/pod/perlglossary.pod
@@ -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
diff --git a/pod/perlothrtut.pod b/pod/perlothrtut.pod
index 3253097ec0..e0d69c5059 100644
--- a/pod/perlothrtut.pod
+++ b/pod/perlothrtut.pod
@@ -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;