[ale] OO Perl
Fletch
fletch at phydeaux.org
Thu Apr 15 22:43:01 EDT 2004
>>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:
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
More information about the Ale
mailing list