[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] OO Perl
- Subject: [ale] OO Perl
- From: fletch at phydeaux.org (Fletch)
- Date: Thu Apr 15 22:43:01 2004
- In-reply-to: <[email protected]> (Christopher Fowler's message of "Thu, 15 Apr 2004 12:31:10 -0400")
- References: <[email protected]>
>>>>> "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
- Follow-Ups:
- [ale] OO Perl
- From: cfowler at outpostsentinel.com (Christopher Fowler)
- References:
- [ale] OO Perl
- From: cfowler at outpostsentinel.com (Christopher Fowler)