package One; sub data { print $_ while <DATA>; } 1; __DATA__ here we have the data section of One.pm package Two; our @ISA = qw(One); sub new { my $self = {}; bless $self, __PACKAGE__; } 1; __DATA__ here we have the data section of Two.pm # and a script to use them: use lib '.'; use One; use Two; my $two = Two->new; $two->data; ### and the output: $ perl script.pl here we have the data section of One.pm
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: odd: __DATA__ sections are not polymorphic
by Aristotle (Chancellor) on Oct 04, 2003 at 18:35 UTC | |
|
Re: odd: __DATA__ sections are not polymorphic
by Zaxo (Archbishop) on Oct 05, 2003 at 05:16 UTC |