X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlref.pod;h=afc1671fdf33995fc16b532dd06f4b24777e1c5f;hb=63acfd0033368edc5dd21a89732267e5921511f1;hp=21f15d41eb1bf4ac82ddb27991b5e7afc3899e38;hpb=ee6b43cc19efb39ed8a2fdad01d701e59dbdd946;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlref.pod b/pod/perlref.pod index 21f15d4..afc1671 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -210,17 +210,18 @@ that most Perl programmers need trouble themselves about to begin with. =item 5. X X -References are often returned by special subroutines called constructors. -Perl objects are just references to a special type of object that happens to know -which package it's associated with. Constructors are just special -subroutines that know how to create that association. They do so by -starting with an ordinary reference, and it remains an ordinary reference -even while it's also being an object. Constructors are often -named new() and called indirectly: - - $objref = new Doggie (Tail => 'short', Ears => 'long'); - -But don't have to be: +References are often returned by special subroutines called constructors. Perl +objects are just references to a special type of object that happens to know +which package it's associated with. Constructors are just special subroutines +that know how to create that association. They do so by starting with an +ordinary reference, and it remains an ordinary reference even while it's also +being an object. Constructors are often named C. You I call them +indirectly: + + $objref = new Doggie( Tail => 'short', Ears => 'long' ); + +But that can produce ambiguous syntax in certain cases, so it's often +better to use the direct method invocation approach: $objref = Doggie->new(Tail => 'short', Ears => 'long');