From: David Glasser Date: Mon, 29 May 2000 21:15:59 +0000 (-0400) Subject: Eliminate $a/$b in pod X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=697934ef381c2fbd2ff49c5e4b22e596a509b7a0;p=p5sagit%2Fp5-mst-13.2.git Eliminate $a/$b in pod To: perl5-porters@perl.org Message-Id: p4raw-id: //depot/cfgperl@6206 --- diff --git a/pod/perl5004delta.pod b/pod/perl5004delta.pod index 85a8f96..2ade235 100644 --- a/pod/perl5004delta.pod +++ b/pod/perl5004delta.pod @@ -1489,7 +1489,7 @@ subroutine, and outside that is another subroutine; and the anonymous (innermost) subroutine is referencing a lexical variable defined in the outermost subroutine. For example: - sub outermost { my $a; sub middle { sub { $a } } } + sub outermost { my $x; sub middle { sub { $x } } } If the anonymous subroutine is called or referenced (directly or indirectly) from the outermost subroutine, it will share the variable diff --git a/pod/perl56delta.pod b/pod/perl56delta.pod index 5a824ac..16a06c4 100644 --- a/pod/perl56delta.pod +++ b/pod/perl56delta.pod @@ -487,7 +487,7 @@ required for C<< foo(10)->('bar') >>. =head2 Boolean assignment operators are legal lvalues -Constructs such as C<($a ||= 2) += 1> are now allowed. +Constructs such as C<($x ||= 2) += 1> are now allowed. =head2 exists() is supported on subroutine names diff --git a/pod/perlboot.pod b/pod/perlboot.pod index b549f45..c9ee9a5 100644 --- a/pod/perlboot.pod +++ b/pod/perlboot.pod @@ -87,8 +87,8 @@ And once again, this results in: That's not fun yet. Same number of characters, all constant, no variables. But yet, the parts are separable now. Watch: - $a = "Cow"; - $a->speak; # invokes Cow->speak + $x = "Cow"; + $x->speak; # invokes Cow->speak Ahh! Now that the package name has been parted from the subroutine name, we can use a variable package name. And this time, we've got @@ -392,8 +392,8 @@ So far, we've seen the method arrow syntax: or the equivalent: - $a = "Class"; - $a->method(@args); + $x = "Class"; + $x->method(@args); which constructs an argument list of: diff --git a/pod/perlbot.pod b/pod/perlbot.pod index bc4e4da..e495266 100644 --- a/pod/perlbot.pod +++ b/pod/perlbot.pod @@ -104,14 +104,14 @@ variables. Named parameters are also demonstrated. package main; - $a = Foo->new( 'High' => 42, 'Low' => 11 ); - print "High=$a->{'High'}\n"; - print "Low=$a->{'Low'}\n"; - - $b = Bar->new( 'Left' => 78, 'Right' => 40 ); - print "Left=$b->[0]\n"; - print "Right=$b->[1]\n"; - + $x = Foo->new( 'High' => 42, 'Low' => 11 ); + print "High=$x->{'High'}\n"; + print "Low=$x->{'Low'}\n"; + + $y = Bar->new( 'Left' => 78, 'Right' => 40 ); + print "Left=$y->[0]\n"; + print "Right=$y->[1]\n"; + =head1 SCALAR INSTANCE VARIABLES An anonymous scalar can be used when only one instance variable is needed. @@ -127,8 +127,8 @@ An anonymous scalar can be used when only one instance variable is needed. package main; - $a = Foo->new( 42 ); - print "a=$$a\n"; + $x = Foo->new( 42 ); + print "a=$$x\n"; =head1 INSTANCE VARIABLE INHERITANCE @@ -159,9 +159,9 @@ object. package main; - $a = Foo->new; - print "buz = ", $a->{'buz'}, "\n"; - print "biz = ", $a->{'biz'}, "\n"; + $x = Foo->new; + print "buz = ", $x->{'buz'}, "\n"; + print "biz = ", $x->{'biz'}, "\n"; @@ -191,9 +191,9 @@ relationships between objects. package main; - $a = Foo->new; - print "buz = ", $a->{'Bar'}->{'buz'}, "\n"; - print "biz = ", $a->{'biz'}, "\n"; + $x = Foo->new; + print "buz = ", $x->{'Bar'}->{'buz'}, "\n"; + print "biz = ", $x->{'biz'}, "\n"; @@ -314,8 +314,8 @@ that it is impossible to override the BAZ() method. package main; - $a = FOO->new; - $a->bar; + $x = FOO->new; + $x->bar; Now we try to override the BAZ() method. We would like FOO::bar() to call GOOP::BAZ(), but this cannot happen because FOO::bar() explicitly calls @@ -351,8 +351,8 @@ FOO::private::BAZ(). package main; - $a = GOOP->new; - $a->bar; + $x = GOOP->new; + $x->bar; To create reusable code we must modify class FOO, flattening class FOO::private. The next example shows a reusable class FOO which allows the @@ -386,8 +386,8 @@ method GOOP::BAZ() to be used in place of FOO::BAZ(). package main; - $a = GOOP->new; - $a->bar; + $x = GOOP->new; + $x->bar; =head1 CLASS CONTEXT AND THE OBJECT @@ -444,10 +444,10 @@ method where that data is located. package main; - $a = Bar->new; - $b = Foo->new; - $a->enter; - $b->enter; + $x = Bar->new; + $y = Foo->new; + $x->enter; + $y->enter; =head1 INHERITING A CONSTRUCTOR @@ -476,8 +476,8 @@ object will be a BAR not a FOO, even though the constructor is in class FOO. package main; - $a = BAR->new; - $a->baz; + $x = BAR->new; + $x->baz; =head1 DELEGATION