Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / Tie / Scalar.html
blobc212543f1d7a72aedbfae22b66b034e9615965fd
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Tie::StdScalar - base class definitions for tied scalars</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;Tie::StdScalar - base class definitions for tied scalars</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <li><a href="#more_information">MORE INFORMATION</a></li>
26 </ul>
27 <!-- INDEX END -->
29 <hr />
30 <p>
31 </p>
32 <h1><a name="name">NAME</a></h1>
33 <p>Tie::Scalar, Tie::StdScalar - base class definitions for tied scalars</p>
34 <p>
35 </p>
36 <hr />
37 <h1><a name="synopsis">SYNOPSIS</a></h1>
38 <pre>
39 package NewScalar;
40 require Tie::Scalar;</pre>
41 <pre>
42 @ISA = (Tie::Scalar);</pre>
43 <pre>
44 sub FETCH { ... } # Provide a needed method
45 sub TIESCALAR { ... } # Overrides inherited method</pre>
46 <pre>
47 package NewStdScalar;
48 require Tie::Scalar;</pre>
49 <pre>
50 @ISA = (Tie::StdScalar);</pre>
51 <pre>
52 # All methods provided by default, so define only what needs be overridden
53 sub FETCH { ... }</pre>
54 <pre>
55 package main;</pre>
56 <pre>
57 tie $new_scalar, 'NewScalar';
58 tie $new_std_scalar, 'NewStdScalar';</pre>
59 <p>
60 </p>
61 <hr />
62 <h1><a name="description">DESCRIPTION</a></h1>
63 <p>This module provides some skeletal methods for scalar-tying classes. See
64 <a href="file://C|\msysgit\mingw\html/pod/perltie.html">the perltie manpage</a> for a list of the functions required in tying a scalar to a
65 package. The basic <strong>Tie::Scalar</strong> package provides a <code>new</code> method, as well
66 as methods <code>TIESCALAR</code>, <code>FETCH</code> and <code>STORE</code>. The <strong>Tie::StdScalar</strong>
67 package provides all the methods specified in <a href="file://C|\msysgit\mingw\html/pod/perltie.html">the perltie manpage</a>. It inherits from
68 <strong>Tie::Scalar</strong> and causes scalars tied to it to behave exactly like the
69 built-in scalars, allowing for selective overloading of methods. The <code>new</code>
70 method is provided as a means of grandfathering, for classes that forget to
71 provide their own <code>TIESCALAR</code> method.</p>
72 <p>For developers wishing to write their own tied-scalar classes, the methods
73 are summarized below. The <a href="file://C|\msysgit\mingw\html/pod/perltie.html">the perltie manpage</a> section not only documents these, but
74 has sample code as well:</p>
75 <dl>
76 <dt><strong><a name="item_tiescalar_classname_2c_list">TIESCALAR classname, LIST</a></strong>
78 <dd>
79 <p>The method invoked by the command <code>tie $scalar, classname</code>. Associates a new
80 scalar instance with the specified class. <code>LIST</code> would represent additional
81 arguments (along the lines of <a href="file://C|\msysgit\mingw\html/lib/AnyDBM_File.html">the AnyDBM_File manpage</a> and compatriots) needed to
82 complete the association.</p>
83 </dd>
84 </li>
85 <dt><strong><a name="item_fetch_this">FETCH this</a></strong>
87 <dd>
88 <p>Retrieve the value of the tied scalar referenced by <em>this</em>.</p>
89 </dd>
90 </li>
91 <dt><strong><a name="item_store_this_2c_value">STORE this, value</a></strong>
93 <dd>
94 <p>Store data <em>value</em> in the tied scalar referenced by <em>this</em>.</p>
95 </dd>
96 </li>
97 <dt><strong><a name="item_destroy_this">DESTROY this</a></strong>
99 <dd>
100 <p>Free the storage associated with the tied scalar referenced by <em>this</em>.
101 This is rarely needed, as Perl manages its memory quite well. But the
102 option exists, should a class wish to perform specific actions upon the
103 destruction of an instance.</p>
104 </dd>
105 </li>
106 </dl>
108 </p>
109 <hr />
110 <h1><a name="more_information">MORE INFORMATION</a></h1>
111 <p>The <a href="file://C|\msysgit\mingw\html/pod/perltie.html">the perltie manpage</a> section uses a good example of tying scalars by associating
112 process IDs with priority.</p>
113 <table border="0" width="100%" cellspacing="0" cellpadding="3">
114 <tr><td class="block" style="background-color: #cccccc" valign="middle">
115 <big><strong><span class="block">&nbsp;Tie::StdScalar - base class definitions for tied scalars</span></strong></big>
116 </td></tr>
117 </table>
119 </body>
121 </html>