in reply to OO and <DATA>
You can deal with this problem by further isolating your use of the __DATA__ section behind a method that does a one-time, lazy setup from <DATA>. This turns my $doc = $self->{'parser'}->parse_string(<DATA>); into
my $stylesheet = $self->get_stylesheet(); my $doc = $self->{'parser'}->parse_string($stylesheet);
This also frees you to override get_stylesheet() in subclasses. How and where get_stylesheet() gets the stylesheet is an implementation detail. A subclass needn't use the __DATA__ section.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: OO and <DATA>
by trs80 (Priest) on Aug 25, 2002 at 16:05 UTC | |
by BUU (Prior) on Aug 25, 2002 at 17:28 UTC | |
by jeffa (Bishop) on Aug 25, 2002 at 18:40 UTC |