From: Abigail Date: Sat, 20 Feb 2010 17:54:15 +0000 (+0100) Subject: Document differences between Tie::Scalar and Tie::StdScalar X-Git-Tag: accepted/trunk/20130322.191538~9444^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b588e26b0530f7ecd738579dc5febbca2ebc6d7b;p=platform%2Fupstream%2Fperl.git Document differences between Tie::Scalar and Tie::StdScalar --- diff --git a/lib/Tie/Scalar.pm b/lib/Tie/Scalar.pm index 9bf03f9..8048569 100644 --- a/lib/Tie/Scalar.pm +++ b/lib/Tie/Scalar.pm @@ -73,6 +73,18 @@ destruction of an instance. =back +=head2 Tie::Scalar vs Tie::StdScalar + +C<< Tie::Scalar >> provides all the necessary methods, but one should realize +they do not do anything useful. Calling C<< Tie::Scalar::FETCH >> or +C<< Tie::Scalar::STORE >> results in a (trappable) croak. And if you inherit +from C<< Tie::Scalar >>, you I provide either a C<< new >> or a +C<< TIESCALAR >> method. + +If you are looking for a class that does everything for you you don't +define yourself, use the C<< Tie::StdScalar >> class, not the +C<< Tie::Scalar >> one. + =head1 MORE INFORMATION The L section uses a good example of tying scalars by associating