[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Thu Apr 15 22:43:01 2004 -->
- <!--x-from-r13: syrgpu ng culqrnhk.bet (Tyrgpu) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] OO Perl -->
- <li><em>date</em>: Thu Apr 15 22:43:01 2004</li>
- <li><em>from</em>: fletch at phydeaux.org (Fletch)</li>
- <li><em>in-reply-to</em>: <[email protected]> (Christopher Fowler's message of "Thu, 15 Apr 2004 12:31:10 -0400")</li>
- <li><em>references</em>: <[email protected]></li>
- <li><em>subject</em>: [ale] OO Perl</li>
Christopher> I'm creating a Properties class to use with config
Christopher> files for my cgi programs
[...]
Christopher> How can I store $options in a Properties object?
Your blessed hash reference can store things just like any other
hashref.
sub parse_options {
my $self = shift;
... your code ...
$self->{'_options'} = $options;
return $self;
}
See perldoc perltoot and perldoc perlboot, both of which should cover
this usage.
If you want to be really OOPy, you might also want to look into
Class::MethodMaker for writing accessors automatically. Also look
into the AppConfig module which handles parsing .INI-like config files
for you.
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org | Vincent, you should cease askin' \ o.O'
| scary questions." -- Jules =(___)=
| U
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00565" href="msg00565.html">[ale] OO Perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00538" href="msg00538.html">[ale] OO Perl</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00553.html">[ale] (no subject)</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00555.html">[ale] (no subject)</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00538.html">[ale] OO Perl</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00565.html">[ale] OO Perl</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00554"><strong>Date</strong></a></li>
<li><a href="threads.html#00554"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>