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">
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:" />
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"> Tie::StdScalar - base class definitions for tied scalars
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
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>
32 <h1><a name=
"name">NAME
</a></h1>
33 <p>Tie::Scalar, Tie::StdScalar - base class definitions for tied scalars
</p>
37 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
40 require Tie::Scalar;
</pre>
42 @ISA = (Tie::Scalar);
</pre>
44 sub FETCH { ... } # Provide a needed method
45 sub TIESCALAR { ... } # Overrides inherited method
</pre>
48 require Tie::Scalar;
</pre>
50 @ISA = (Tie::StdScalar);
</pre>
52 # All methods provided by default, so define only what needs be overridden
53 sub FETCH { ... }
</pre>
57 tie $new_scalar, 'NewScalar';
58 tie $new_std_scalar, 'NewStdScalar';
</pre>
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>
76 <dt><strong><a name=
"item_tiescalar_classname_2c_list">TIESCALAR classname, LIST
</a></strong>
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>
85 <dt><strong><a name=
"item_fetch_this">FETCH this
</a></strong>
88 <p>Retrieve the value of the tied scalar referenced by
<em>this
</em>.
</p>
91 <dt><strong><a name=
"item_store_this_2c_value">STORE this, value
</a></strong>
94 <p>Store data
<em>value
</em> in the tied scalar referenced by
<em>this
</em>.
</p>
97 <dt><strong><a name=
"item_destroy_this">DESTROY this
</a></strong>
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>
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"> Tie::StdScalar - base class definitions for tied scalars
</span></strong></big>