X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlmod.pod;h=3d5f3ad0a4b7d9a0b0224eb651308f95c888afb0;hb=953f6acfa20ec275ec39a552dfac8124bd93ebdf;hp=53f3d21c656df1201b3a595a36296a18a6034819;hpb=59f521f4af7acce29f3bf3ecf4f2c911e305e59b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlmod.pod b/pod/perlmod.pod index 53f3d21..3d5f3ad 100644 --- a/pod/perlmod.pod +++ b/pod/perlmod.pod @@ -94,18 +94,9 @@ C<%main::>, or C<%::> for short. Likewise the symbol table for the nested package mentioned earlier is named C<%OUTER::INNER::>. The value in each entry of the hash is what you are referring to when you -use the C<*name> typeglob notation. In fact, the following have the same -effect, though the first is more efficient because it does the symbol -table lookups at compile time: +use the C<*name> typeglob notation. local *main::foo = *main::bar; - local $main::{foo} = $main::{bar}; - -(Be sure to note the B difference between the second line above -and C. The former is accessing the hash -C<%main::>, which is the symbol table of package C
. The latter is -simply assigning scalar C<$bar> in package C
to scalar C<$foo> of -the same package.) You can use this to print out all the variables in a package, for instance. The standard but antiquated F library and @@ -581,6 +572,9 @@ Like C, C is called once per package; however, it is called just before cloning starts, and in the context of the parent thread. If it returns a true value, then no objects of that class will be cloned; or rather, they will be copied as unblessed, undef values. +For example: if in the parent there are two references to a single blessed +hash, then in the child there will be two references to a single undefined +scalar value instead. This provides a simple mechanism for making a module threadsafe; just add C at the top of the class, and C will be now only be called once per object. Of course, if the child thread needs