summaryrefslogtreecommitdiff
path: root/pod/perltoot.pod
diff options
context:
space:
mode:
authorpadre@elte.hu <padre@elte.hu>2004-03-10 17:05:09 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-13 21:27:57 +0000
commit0184c62dc331bcf7dca96c57c46dafcd327c65e7 (patch)
tree28fae8d8037bf6715e9caac5f71a8660f9a90dbb /pod/perltoot.pod
parentf15752a524e132bcba8293837a456fb70f6471d9 (diff)
downloadperl-0184c62dc331bcf7dca96c57c46dafcd327c65e7.tar.gz
[perl #27567] [patch] a typo and a mistake in perltoot.pod
From: "padre@elte.hu (via RT)" <perlbug-followup@perl.org> Message-ID: <rt-3.0.8-27567-81174.13.282806825515@perl.org> p4raw-id: //depot/perl@22497
Diffstat (limited to 'pod/perltoot.pod')
-rw-r--r--pod/perltoot.pod12
1 files changed, 8 insertions, 4 deletions
diff --git a/pod/perltoot.pod b/pod/perltoot.pod
index 2497063877..8d224dd341 100644
--- a/pod/perltoot.pod
+++ b/pod/perltoot.pod
@@ -1131,9 +1131,9 @@ above, just add this to Person.pm:
our $VERSION = '1.1';
-and then in Employee.pm could you can say
+and then in Employee.pm you can say
- use Employee 1.1;
+ use Person 1.1;
And it would make sure that you have at least that version number or
higher available. This is not the same as loading in that exact version
@@ -1497,10 +1497,10 @@ Here's a simple example of using it:
struct 'Fred' => {
one => '$',
many => '@',
- profession => Jobbie, # calls Jobbie->new()
+ profession => 'Jobbie', # does not call Jobbie->new()
};
- $ob = Fred->new;
+ $ob = Fred->new(profession => Jobbie->new());
$ob->one("hmmmm");
$ob->many(0, "here");
@@ -1514,6 +1514,10 @@ You can declare types in the struct to be basic Perl types, or
user-defined types (classes). User types will be initialized by calling
that class's new() method.
+Take care that the C<Jobbie> object is not created automatically by the
+C<Fred> class's new() method, so you should specify a C<Jobbie> object
+when you create an instance of C<Fred>.
+
Here's a real-world example of using struct generation. Let's say you
wanted to override Perl's idea of gethostbyname() and gethostbyaddr() so
that they would return objects that acted like C structures. We don't