<?xml version="1.0" encoding="windows-1252"?>
<node id="361499" title="tadman's scratchpad" created="2004-06-05 07:57:44" updated="2005-08-15 01:39:18">
<type id="182711">
scratchpad</type>
<author id="49599">
tadman</author>
<data>
<field name="doctext">
In the course of creating a sort of "restricted" scalar type, I've d
The idea is to create a variable which is restricted, for example, a scalar which can only contain a fixed number of characters. Ideally, it would work something like this:
&lt;BLOCKQUOTE&gt;&lt;CODE&gt;my $super_scalar = SuperScalar-&gt;new(length =&gt; 15);
&lt;/code&gt;&lt;/blockquote&gt;
Which would make $special_scalar type 'SuperScalar', though as you can see, the mechanics of this are not so simply implemented.
&lt;BR&gt;
&lt;BR&gt;
So far, I have to make $special_scalar a reference to the actual "special scalar" tie'd variable, which means when you use this thing it gets all messy:
&lt;BLOCKQUOTE&gt;&lt;CODE&gt;$super_scalar = "Something Really Big...";

print $super_scalar,"$_\n";   # Prints "Something Reall\n"
&lt;/code&gt;&lt;/blockquote&gt;
The limitation, it seems, is that when a scalar imports a value from another, it doesn't import the tied type.</field>
</data>
</node>
