[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



    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>