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.
In reply to Re: OO and <DATA>
by dws
in thread OO and <DATA>
by rattusillegitimus
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |